Hypnic jerk

A hypnic jerk, hypnagogic jerk or sleep twitch sometimes happens when a person is falling asleep. It is an involuntary movement, that is, not done on purpose. It may cause them to jump and awaken suddenly for a moment. 
Hypnic jerks are one form of involuntary muscle twitches called "myoclonus". Such movements do occur in healthy people. They have been associated with causes such as irregular sleep patterns or stress. Certain substances such as caffeine may also cause them.