There are four major classes of headache that can variably interact with sleep. Some may occur exclusively at night and others, such as migraine, may actually be relieved by sleep. In addition, morning headaches may suggest an underlying sleep disorder such as sleep apnea.
Migraine is an intense and often debilitating headache disorder. It may be associated with visual changes such as seeing bright lights or stars, nausea, vomiting, and sometimes even numbness or weakness. Getting either too little or too much sleep may provoke a migraine headache. One sub-type, called nocturnal migraine, occurs during REM sleep. Sleep can often be helpful for relieving the symptoms of migraine, and afflicted individuals will often find comfort in lying in a dark, quiet room until they have recovered. The relationship between migraine and sleep seems to be due to the neurotransmitter called serotonin.
Cluster headaches frequently afflict males and may occur in multiples over a short period of time. The headache can be quite intense and may localize around the eye or temple. Cluster headaches can occur predominately or even exclusively at night. In this case, they often arise from REM sleep.
In what is a rare disorder, hypnic headaches occur recurrently and typically affect the elderly. These moderately severe headaches are diffuse in character and occur almost exclusively during sleep. They tend to occur at the same time each night and last from 30 minutes up to two hours. Hypnic headaches may respond to medications such as lithium and indomethacin.
Morning headaches may result from various causes. They typically occur upon awakening, but may even wake someone from sleep. They tend to be diffuse and dull in quality. Thankfully, they are short lived and often resolve upon getting up. Morning headaches commonly occur in association with sleep apnea, with 36-58% of people with sleep apnea reporting them. The exact cause of this is not known, but it may relate to changes in the oxygen or carbon dioxide levels in the blood. The frequency of apneas or the number of nighttime arousals may also correlate. In general, these will resolve with treatment such as CPAP therapy. Other causes of sleep disruption may also lead to morning headaches, including: restless legs syndrome, insomnia, chronic pain, and even depression or anxiety.
Mowzoon, N et al. “Neurology of Sleep Disorders.” Neurology Board Review: An Illustrated Guide. 2007; 744-745.