aSleep sex or sexsomnia is a form of non-rapid eye movement (NREM) parasomnia (similar to sleepwalking) that causes people to engage in sexual acts such as masturbation, fondling, sexual intercourse and sexual assault or rape while they are asleep. The proposed medical diagnosis is NREM Arousal Parasomnia - Sexual Behavior in Sleep, and is considered to be a distinct variant of sleepwalking .There are often unpleasant consequences associated with sleep sex and it has been used as a criminal defense in rape cases. Other negative effects include feelings of shame and embarrassment and also can cause relationship issue and stress.

Those who suffer from sexsomnia have confusional arousals and rarely remember the event. People who have a history of doing other sleep activities such as sleepwalking or sleep talking are more likely to exhibit sexsomnia episodes. Factors that may increase episodes of sleep sex are alcohol, sleep deprivation or even sleep apnea and other sleep disruptions.
Sexsomnia episodes could be triggered by the contact with bed partner.In some cases sexualised movements during sleep could be caused by sleep related epilepsy which results in sexual arousal, thrusting and orgasms.