There are various stages of sleep that we go through during the night. The most important stage in relation to headache is probably REM sleep. REM sleep, which occurs 4-6 times during the night, is the dreaming state of sleep.