Have you ever started to fall asleep, and then all of a sudden it feels like you're falling and then BAM you jerk yourself awake? This happens to me probably on a weekly basis, and I've always wondered what it is that causes this jerk.
This reflex is most commonly known as a hypnic jerk, and about 70% of people experience this. They are most common in people who have Restless Leg Syndrome and in people who are sleep-deprived. What happens is when you're in the lightest stages of sleep, your body involuntarily jerks one or two times. Not much research has been done on this subject, but one theory suggests that these jerks occur because when you are about to fall asleep, all of the muscles in your body relax and your body temperature and breathing rates change as well.
These changes can be misinterpreted by the brain, and so it sends an electrical signal to your nervous system to make sure you're not falling or dying, which then causes the spasm of muscles. It is especially common in people who are anxious or are sleep deprived; when they try and go to sleep, their muscles try to relax while their brain remains awake, which causes them to be more likely to experience the hypnic jerk.
In rarer cases, some people have more regular muscle spasms in the lighter stages of sleep, occurring around every 30 seconds or so. This condition is called periodic limb movement disorder, or PLMD. Often times these types of jerks also cause the sleeper to wake up, or else it causes them to have a more restless night of sleep. Scientists are not sure what the causes are of PLMD and don't know whether or not it is related to hypnic jerks.