"A hypnic jerk, or hypnagogic massive jerk, usually occurs just as we are falling asleep. People often describe it as a falling sensation or an electric shock, and it is a completely normal experience. It most commonly occurs when sleeping uncomfortably or over-tired. There has been little research done on the subject, but there are some theories as to why hypnic jerks occur.
When we drift of into sleep, the body undergoes changes in temperature, breathing and muscle relaxation. The hypnic jerk may be a result of the muscles relaxing. The brain misinterprets this as a sign of falling and signals our limbs to wake up; hence the jerking legs or arms.
A hypnic jerk may also occur during the Rapid Eye Movement phase of sleep. The REM phase is the time when dreams happen and all voluntary muscular activity stops along with a complete drop in muscle tone. During REM, some individuals experience slight eye or ear twitching, and this is also when the hypnic jerk occurs. Some people with sleep disorders do not achieve muscular relaxation and have been known to act out their dreams.
In most people, a hypnic jerk usually occurs just once or twice a night. However, when a person is deprived of sleep or trying to fight sleep, it may happen more often. In extreme cases, the muscle twitches can happen every thirty seconds or more. This disorder is called periodic limb movement.
Another theory put forward to try and explain the hypnic jerk is that the body reacts to falling asleep much in the way that a body may twitch when dying. The hypnic jerk is a reflex used to keep the body functioning. The brain might register falling asleep as a situation in which the body needs to be stimulated."