It's a nervous system reaction to relaxation of all of your muscles. My husband and boys do this, and it seems the more exhausted they are, the stronger the twitch.
My dad does this alot and the Dr. 's call it myoclonus,it occurs when there's lack of oxygen to the brain, the body jerks to wake him so he would breath.