The 353rd prohibition is that we are forbidden from deriving pleasure from any forbidden partner,1 even without sexual relations, e.g. through kissing, hugging, and the like.
The source of this prohibition is G‑d's statement,2 "To a close relative, do not approach to have forbidden sexual relations," as if to say, "do not come close to them in any type of closeness which could lead to sexual relations."
The Sifra says, "The phrase, "Do not approach to have forbidden sexual relations," would seem only to prohibit actual sexual relations. How do we know that one may not have other types of closeness? From the verse,3 'Do not come close to a woman who is unclean from being in nidah (menstruant).' This only proves that both relations and closeness are forbidden with a woman who is in nidah. How do we know that the same applies to all forbidden partners? From the verse, 'Do not approach to have forbidden sexual relations.' " There it also says, "What is the meaning of the phrase,4 'Those who do5 [these sexual violations] shall be cut off spiritually'? Since it says, 'Do not approach,' one might think that karet is incurred even for other forms of closeness; the verse therefore says 'those who do,' not 'those who come close.' " The Torah repeats its prohibition of these vulgar acts in the verse,6 'Do not follow any of the perverted customs'
However,7 the two prohibitions,8 "Do not follow the ways of Egypt where you once lived, nor the ways of Canaan...," do not just prohibit the "perverted customs' [and therefore repetitions of the prohibition against acts of closeness], but rather the perversions themselves which are listed in the subsequent verses. These two prohibitions therefore include all forbidden sexual relations; but since the prohibition against following "the ways of Egypt" and "the ways of Canaan" includes all their immoral acts,9 and matters of agriculture, raising animals, and social life, the Torah therefore continued by specifying the specific type of sexual relation referred to — this type, another type, and so on. This is clear from the verse at the end of this section,10 "The people who lived in the land before you did all these disgusting perversions." The Sifra says, "I would think [from the ban on following 'the ways of Egypt,' etc.] that one may not construct buildings or plant vineyards like theirs. The Torah therefore adds,11 'Do not follow [any] of their customs' — the prohibition covers only customs which have been practiced by they and their forefathers." And there it explains, "What did they used to do? A man would marry another man; a woman another woman; and one woman would marry two men."
This all proves that the prohibitions against following "the ways of Egypt" and "the ways of Canaan" are of a general nature, covering all forbidden sexual relations. Afterwards, the particular categories are each mentioned separately.
The details of this mitzvah are explained in the Commentary on the Mishnah to the seventh chapter of Sanhedrin, where it is also explained that the punishment is lashes.
It is also important to know that in any case where sexual relations are forbidden upon punishment of karet, a child conceived from that forbidden union is called a mamzer. G‑d has called this child a mamzer, whether the forbidden union was intentional or accidental — with the exception of a child born from a union when the mother was in nidah. Then the child is not called a mamzer, but a ben nidah. This is explained in the fourth chapter of Yevamot.12