The feeling of jerking awake just as sleep begins to overtake us is familiar to most readers. So too is seeing someone in a deep sleep eerily (or adorably) twitching their hands or feet. What is it that makes people do this while they are supposed to be resting?
First, the good news. Medical science has come up with an official sounding word for twitching: myoclonus. I'm sure we all feel more secure already. Unfortunately, there's not a lot of data on why exactly we experience sleep myoclonus. Since it happens spontaneously in normal sleepers, and they aren't likely to complain, it's tough to study under normal circumstances. Doctors usually only get involved when the twitching has gotten so bad that it's keeping people awake. In these cases, it can be a sign of early brain disorders (like Parkinson's or Alzheimer's), an indication of a severe head or nerve injury, or a symptom of fibromyalgia. All of these imply that twitching is the result of crossed wires between the conscious brain and unconscious motion of the body.
This is why most vigorous twitching occurs in the last phase before deep sleep. Scientists have conducted studies during which they essentially bored sleep-deprived subjects to sleep by asking to push a button whenever they heard a tone. When the subjects had nodded off, and the tone sounded, and the subjects sputtered back to consciousness - but only after a delay of a few seconds. The conscious brain was still working, it just couldn't get through to the body until after the stimulus had gone. This experiments led scientists to believe that most twitch-awakes are in response to some small sound that eventually made its way to their motor response and got them to jerk awake. Most people associate the jerk-awake phenomenon with a sensation of falling or drifting. This could be what it feels like to lose control of motor function — it's just that usually we're too asleep to notice.
And how is motor function shut down? A lack of serotonin. It seems that serotonin doesn't just make us feel good, it also helps the larger muscles move. The body stops making it during sleep, which is why we generally don't wake up running into walls. (Although, technically some people do. Certain people have conditions that do not let them relinquish control of the larger muscles during sleep and wake themselves constantly and violently.) The smaller muscles, though, are not governed by serotonin. They twitch whether we're feeling good or not. This is why eyes, lips, hands, and feet twitch spasmodically while people dream in deepest sleep, while larger muscles don't move. The small motions don't run any risk of waking us or injuring us, so they are allowed to keep functioning, while the large powerful muscles in the body are paralyzed.