"People need to be in a dark room and in bed when they take sleep medication," said Walsleben. "A lot of times, they'll just take it and think they have 20 minutes or so to send an e-mail or a text message."
Sex during sleep, or sexomnia, is a sub-category of the parasomnias known as confusion arousals, according to Dyken. Confusion arousals occur when a person is in a mixed state of being both asleep and awake.
A recent study in the Journal of Sleep Research analyzed more than 800 people suspected of having sleep disorders. The study found that about 8 percent of them were having sex while they slept.
"There's probably a lot more of it going on than people like to talk about," said Emsellem.
Sexomnia is characterized by an extreme level of sexual arousal, and people who exhibit it may masturbate or engage in sexual activity with their partner lying next to them and not remember it.
"It's very troubling to patients and their bed partners," Emsellem said.