Using 11 case studies as a basis for their research, Shapiro, Trajanovic & Fedoroff (2003) use the term sexsomnia to describe a sleep disorder where people have been found to inititate sexual acts (masturbation, intercourse with partners or even sexual assault) while asleep. This complex behaviour appears to originate for most in nonrapid eye movement sleep but can occur at any time during sleep and can last for more than 30 minutes. Sexsomnia is different from sleepwalking in the sense that arousal is automatic, the person’s  motor activities are more specific and restricted and a form of “dream thinking” is also likely to be present.

Shapiro, C.M., Trajanovic, N.N., & Fedoroff, J.P. (2003) Sexsomnia: A new parasomnia? Canadian Journal of Psychiatry, 48(5), 311-317