What Causes Sleepwalking? Brain, Genes, and Triggers

Sleepwalking happens when part of your brain stays in deep sleep while another part activates enough to move your body. It affects about 5% of children and 1.5% of adults in any given year, and its causes range from genetics and sleep deprivation to medications and underlying sleep disorders.

A Brain Caught Between Sleep and Waking

Sleepwalking occurs during the deepest stages of non-REM sleep, known as stages 3 and 4. During these phases, your brain produces large, slow electrical waves associated with restorative rest. Normally, your body’s motor systems shut down in sync with the rest of your brain. In sleepwalking, they don’t.

Researchers now describe this as “state dissociation,” meaning sleep and wakefulness aren’t fully separate. When you look at brain recordings during a sleepwalking episode, you see a mix: the slow waves of deep sleep layered with faster waves typical of being awake. The result is a person who can walk, open doors, or even drive a car while remaining genuinely unconscious and unable to form memories. The brain’s systems for movement have woken up, but the systems for awareness, judgment, and memory have not.

This is why sleepwalkers often have a blank stare, respond poorly to questions, and rarely remember anything the next morning. They aren’t choosing to move. Their motor cortex is simply operating on a different schedule than the rest of the brain.

Genetics Play a Major Role

Sleepwalking runs strongly in families. If one or both of your parents sleepwalked, your risk is substantially higher. Research into the genetic basis has identified a specific immune-system gene called HLA-DQB1 as a likely contributor. In a study of 60 people with sleepwalking disorder, 35% carried a particular variant of this gene compared to just 13% of people without sleep disorders, making carriers roughly 3.5 times more likely to sleepwalk.

In families with multiple sleepwalkers, a specific amino acid variation in that gene was passed down to affected members at five times the expected rate. Interestingly, this same gene family is also implicated in narcolepsy and a condition where people physically act out their dreams. That pattern suggests these genes influence how well the brain controls movement during sleep more broadly, not just in sleepwalking alone.

Common Triggers for Episodes

Even people with a genetic predisposition don’t sleepwalk every night. Episodes tend to be set off by specific triggers that disrupt the normal architecture of deep sleep:

  • Sleep deprivation. When you haven’t slept enough, your brain compensates by spending more time in deep sleep stages, which is exactly where sleepwalking originates. The deeper and more prolonged those stages, the more opportunity for a partial arousal.
  • Alcohol. Drinking before bed acts as a sedative that initially deepens sleep, then fragments it as your body metabolizes the alcohol. That fragmentation creates the kind of incomplete arousals that trigger episodes.
  • Stress and anxiety. Emotional stress disrupts sleep continuity, increasing the number of times your brain partially surfaces from deep sleep without fully waking.
  • Fever. Illness-related fevers, particularly in children, can destabilize sleep stages and provoke sleepwalking in those who are susceptible.
  • Irregular sleep schedules. Shift work, jet lag, or inconsistent bedtimes can throw off your sleep cycles enough to increase deep-sleep instability.

Medications That Can Cause Sleepwalking

Certain prescription sleep aids are strongly linked to sleepwalking and other complex sleep behaviors like sleep-driving and sleep-eating. The FDA has placed its strongest warning, a Boxed Warning, on three sedative-hypnotic medications: eszopiclone (Lunesta), zaleplon (Sonata), and zolpidem (Ambien). These drugs are now contraindicated for anyone who has experienced even one episode of complex sleep behavior while taking them.

The risk with these medications appears higher than with other sleep aids. The drugs work by enhancing the brain’s ability to enter and maintain sleep, but in some people they suppress awareness while leaving motor function partially active, essentially creating the same dissociated state that causes sleepwalking naturally. Other sedating medications, including certain antidepressants and antipsychotics, have also been reported as triggers, though less consistently.

Sleep Apnea and Other Medical Causes

Obstructive sleep apnea, a condition where breathing repeatedly stops during sleep, is a recognized trigger for sleepwalking. Each time breathing pauses, oxygen levels drop and the brain is forced into a brief, partial arousal to restart airflow. These micro-arousals happen dozens or even hundreds of times per night in severe cases, and each one is an opportunity for the brain to get stuck in that half-asleep, half-awake state.

Research has found that more severe sleep apnea correlates with higher rates of sleepwalking, likely because the frequent breathing interruptions reinforce deep sleep instability. Treating the apnea, typically with a device that keeps the airway open during sleep, often reduces or eliminates sleepwalking episodes as well. This is one reason adults who develop sleepwalking for the first time later in life are often evaluated for breathing disorders.

Why Children Sleepwalk More Than Adults

Children between ages 4 and 8 are the most likely age group to sleepwalk, with a current prevalence around 5% compared to 1.5% in adults. The reason is straightforward: children spend far more time in deep slow-wave sleep than adults do. As the brain matures through adolescence, the proportion of deep sleep naturally decreases, and most childhood sleepwalking resolves on its own without treatment. The nervous system simply gets better at keeping sleep and wakefulness fully separated.

Adults who continue to sleepwalk, or who start sleepwalking for the first time, are more likely to have an identifiable trigger like a medication, a sleep disorder, or significant sleep deprivation.

Keeping a Sleepwalker Safe

Because sleepwalkers have no awareness or judgment during episodes, the priority is preventing injury. Locking windows and exterior doors, installing gates at the top of staircases, and removing sharp or breakable objects from common walking paths are the most effective steps. Sleeping on the ground floor reduces fall risk. Some families place a bell on the sleepwalker’s bedroom door as an early alert system.

If you encounter someone sleepwalking, gently guide them back to bed rather than trying to wake them abruptly. Forcing someone awake from deep sleep often causes confusion and distress without any benefit. The episode will end on its own, usually within a few minutes.

For frequent sleepwalkers, addressing the underlying cause is more effective than managing episodes individually. Improving sleep hygiene, keeping a consistent schedule, cutting alcohol before bed, and treating conditions like sleep apnea can all reduce how often episodes occur. In persistent cases, scheduled awakenings (briefly waking the person about 15 to 30 minutes before episodes typically happen) can disrupt the pattern of deep sleep that triggers them.