Sleep disorders are closely intertwined with different kinds of headache disorders. In some forms of headaches, this association is profound, such as in hypnic headache, where headaches only occur during sleep, or in cluster headache, which has connection to the REM sleep. In other headaches, the association with sleep is more subtle, but nevertheless, very relevant–for instance in migraine, where sleep deprivation or excessive sleep may act as a trigger for migraine, while sleep has a curative effect on the migraine attack. This chapter focuses in the relationship between sleep disorders and headaches focusing on the five primary forms of headaches: migraine, tension-type headache, paroxysmal hemicrania, hypnic headache, and secondary form of headaches such as obstructive-sleep-apnea-related headaches and medication overuse headaches (MOH).
- sleep deprivation
The association between headaches and sleep is well known for more than 100 years . Some headaches emerge from specific sleep stages, other headaches originate from nonspecific sleep stages, and finally some are triggered by insufficient sleep or over-sleeping and are relieved by sleep. Changes in sleep pattern is a known factor that predisposes and perpetuates headaches in an acute or chronic fashion. Sleep disorders are associated with both, primary headache syndromes such as migraines, tension-type headaches, cluster headaches, hypnic headaches, and secondary headache disorders such as headaches-on-awakening, and MOH . Primary headaches are headaches where pain and associated features such as nausea or light sensitivity are the illness, and secondary headaches are headaches that result from an underlying medical disorder. The number of sleep disorders associated with headaches is also vast, such as OSA, insomnia, RLS, etc.  In general, at times, more than one type of sleep disorder may coexist in a single patient, and the same applies to headache disorders.
Headaches and sleep disorders share similar neurochemistry and neuroanatomy. The ascending reticular activating system (ARAS) is a multi-neuronal polysynaptic system, which promotes wakefulness. The ARAS has two main ascending activating pathways: first one is located in the brainstem, and projects to the thalamus, and the second is a thalamocortical pathway with its glutamate-containing neurons. The second pathway is a mono-aminergic with several brainstem nuclei including periaqueductal gray (dopamine), locus coeruleus (noradrenaline), dorsal raphe nuclei (serotonin), and tuberomammillary (histamine). These nuclei containing neurochemical neurons project through the hypothalamus to the basal forebrain (cholinergic system) and to the cerebral cortex, to promote wakefulness. Finally, hypocretin-containing neurons (excitatory neuropeptide) that via lateral hypothalamus project to the cerebral cortex to awake it .
Sleep is divided into rapid eye movement (REM) sleep and non-REM (NREM) sleep. Non-REM sleep is subdivided in three sleep stages: stage N1, stage N2, and stage N3. Stage N1 is a bridge between wakefulness and sleep (light sleep stage) where individual can be easily aroused. As sleep deepens, it moves into stage N2 defined by the presence of spindles and K-complex on the EEG, and Stage N3 a deep sleep stage where people are hard to arouse. The neurons that induce non-REM sleep are located in the anterior hypothalamus and inhibit the ARAS and the main neurochemicals are serotonin and gamma-aminobutyric acid (GABA). REM-sleep is defined by electroencephalographic features of wakefulness, loss of muscle tone (atonia), and rapid eye movements. The neurons that induce REM sleep are located in the upper pons and the main neurochemical is acetylcholine .
The rhythmicity of awake and sleep stages, also known as circadian rhythm, is regulated by an internal biological “clock” located in the suprachiasmatic nucleus (SCN) in the anterior hypothalamus. Neurons of the SCN are capable of almost constant self-sustained cycle. This rhythmicity is accomplished through a precisely timed and highly regulated negative feedback between specific gene expressions and their resulting proteins. Light exposure, social activities, physical activity, and melatonin (a pineal gland hormone) assist this synchronized, also called entrained, internal clock. The wake and sleep time is also controlled by the homeostatic drive that results from extracellular accumulation of adenosine (ATP byproduct) that increases during wakefulness and the longer is the sleep deprivation period - the more intense is the drive to sleep. The dynamic balance between the circadian and homeostatic drive promotes either wakefulness or sleep .
Migraine is associated with the inappropriate central activation of painful neuronal pathways. These pathways involve brainstem, thalamus, hypothalamus, and cortex—the same structures which are involved in the regulation of wakefulness and sleep, [5, 6, 7] especially locus coeruleus, dorsal raphe nuclei, periaqueductal gray, and hypothalamus. Brainstem nuclei, locus coeruleus and dorsal raphe nucleus are implicated in the nociceptive control and modification of the cerebral blood flow [5, 6, 7, 8]. Periaqueductal gray stimulation with electrodes may trigger migraine-like headache . DBP of the PAG for other painful disorders was associated with induction of migraine in prior nonmigraines  and increase in iron content in the PAG of migraine patients [11, 12]. In migraine, there is an increment in the regional cerebral blood flow (rCBF) of the dorsal PAG and raphe nuclei . Hypothalamus is implicated in the pathogenesis of migraine and cluster headache. The suprachiasmatic nucleus is localized in the hypothalamus, which connects with the periaqueductal gray, spinal nociceptive, and ARAS, all of which are implicated in mechanisms of pain and headache. Hypothalamus plays a role in the early phase of migraine—premonitory phase, which precedes headache phase by up to 72 hours and presents with fatigue, yawning, food cravings, and is associated with an increase in the hypothalamic blood flow . Hypothalamic activation during cluster headache (CH), increase in the hypothalamus gray matter, and DBS efficacy in treating the refractory CH, supports the theory that hypothallus is implicated in the genesis of CH [15, 16].
3. Clinical diagnosis
The appropriate diagnosis of headaches and sleep disorders, relays on history, physical examination and corroborated by additional tests such as polysomnography, and at times mean sleep latency test (MSLT). Detailed history of headache characteristics is essential, since diagnosis of headache disorders relays solely on history, while the diagnosis of sleep disorders can be approximated by history, but often requires a sleep study for confirmation, for instance for the diagnosis of sleep apnea. Several questionnaires have been designed for the diagnosis of headache and sleep disorders. Headache questionnaire and headache diary may assist in assessment and quantification of the headache’s frequency, severity, associated features, and response to the specific therapy. Sleep questionnaire may also assist in determination of the levels of drowsiness as in the Epworth sleepiness scale, which attempts to assess the levels of drowsiness in different scenarios of daily life, with score of 10 or higher being associated with the significant impairment in the activities of daily leaving. Other questionnaires as STOP-BANG are more specific for determination of the probability of having the sleep apnea. Other questionnaires may determine the severity of the restless leg syndrome. Polysomnography is the gold standard for the diagnosis of sleep disorders, especially obstructive sleep apnea, periodic leg movement of the sleep, and is less likely to diagnose parasomnias and narcolepsy.
4. Headache types and sleep
4.1 Primary headaches associated with sleep disorders
Migraine with and without aura. Migraine is defined as uni- or bilateral, moderate to severe headache associated with photophobia, phonophobia, and nausea and/or vomiting, and aggravated by activity. Migraine is reciprocally intertwined with sleep patterns. Too much or too little sleep at night or irregular sleeping pattern (circadian rhythm disorders or sleep fragmentation) are all common migraine triggers. Meanwhile, sleep may have a curative effect on the migraine headaches—the so-called “healing naps” (2). Nearly 90% of episodic migraineurs who complain of poor sleep quality and poor night sleep, have more severe migraine and increased daily burden . Sleep hygiene could be a trigger or relieving factor for migraine chronicity, depending on whether it is poor or good, respectively . Poor sleep quality and/or duration is a trigger for migraine  and causes increase in migraine frequency . Similarly, Korean study showed increase in frequency of migraine in patients with poor sleep . Migraine is related to several sleep disorders, such as insomnia, OSA, parasomnias, sleep-related movement disorders, REM-sleep related disorders . Half to two-thirds of migraineurs suffer from insomnia —the most common sleep disorder, and migraineurs have a 3-fold increase in daytime sleepiness . Insomnia is more common in patients with chronic migraine (with at least 15 headaches per month) than in patients with episodic migraine . Migraine is closely linked to insomnia as they trigger or aggravate each other [26, 27]. CBT for insomnia improves headache frequency . One third of patients with the refractory chronic daily headache is diagnosed with OSA . There is strong comorbidity between migraine and OSA  and patient with migraine who are compliant with CPAP have lower incidence of headaches. The use of opioids for management of headaches is not recommended, but they are still often used, and are also associated with central sleep apnea  with increase in nocturnal hypoxemia . Patient with more nocturnal migraines are usually older, have longer history of migraine and shorter sleep time, probably related to more sleep fragmentation often seen in older individuals . There is also connection between migraine and RLS with an increase in frequency of RLS in migraines, and also RLS is more severe in patients with migraine , REM sleep behavior disorder (RBD) is more frequent in migraine patients  and these patients have severe headache-related disability and insomnia. Migraines is also associated with bruxism and somnambulism in children .
Cluster headaches: are severe to very severe unilateral headaches, periorbital and temporal in distribution, lasting between 30 and 180 min, frequency of 1–8 headaches per day, and associated with conjunctival injection (red eye), increased lacrimation, rhinorrhea, and restlessness. Circadian and circannual periodicity is a hallmark of cluster headache. Two thirds of headaches occur at night between 9 PM and 10 AM. Cluster headaches are linked to REM sleep and to sleeping late in the morning—which has more REM sleep. The fact that individuals with cluster headaches have lucid recall of dreams 2 hours into sleep support the REM sleep association with CH. Patient with cluster headaches have a high incidence of OSA. A study showed over 8-fold increased risk for OSA in patients with cluster headache, and that risk increases further up to 24-fold in patients with an elevated body mass index of greater than 25 kg/m2 .
Paroxysmal hemicrania (PH) is unilateral headache, side-locked (occurring on the same side), short-lasting, average duration of 30 minutes, occurring multiple times a day (up to 40 attacks a day), associated with autonomic features (conjunctival injection, lacrimation, rhinorrhea, ptosis, etc.) which primarily affects women. PH often occurs at night and is associated with REM sleep and occurs only during REM sleep .
Hypnic headaches (HH) mainly affects elderly male patients, and presents with mild to moderate bilateral headache, which awake patients from sleep, usually between 1 and 3 AM. It was believed to be related REM sleep, but recent studies revealed that its occurrence is more common during NREM sleep .
Exploding head syndrome (EHS) was originally classified as a sleep disorder, which occurs during transition from wakefulness to sleep. Patients report hearing extremely loud or explosive noise, which is nonpainful, but is often associated with significant apprehension . Recently, EHS was reported as an aura of migraine with brainstem aura while patient was fully awake . Previously, EHS was reported as an aura of other type of migraine .
Tension-type headache is the most common type of headaches, which are known as “featureless” headache, in contradistinction to migraine TTH are not usually associated with photophobia, phonophobia, or nausea. Insomnia often triggers or aggravates TTH, whereas sleep may relieve them . Insufficient sleep or oversleeping may trigger TTH [41, 42]. Headaches, sleep disorders and depression may share common brain mechanisms, e.g. dysregulation of serotonin, melatonin and hypothalamic dysfunction and management of sleep disorders and depression is essential for the adequate control of the TTH.
4.2 Secondary headaches associated with sleep disorders
Sleep-apnea-syndrome related headaches; presents with awakening headaches (headaches on awakening rather than headaches that awaken patients from sleep). These headaches start in the morning and resolve 30 min after awakening. They are bilateral frontal headaches, squeezing in character, and daily or almost daily. There is no associated photophobia, phonophobia, or nausea. These headaches are most commonly caused by obstructive sleep apnea (occur in 18–60% of patient with OSA) but also central sleep apnea and hypoventilation. Awakening headaches affects 4–6% of the general population and 18% of patients with insomnia. OSA-related headaches may also present with migraines features, chronic daily headache, or be similar to TTH [40, 41, 42]. The pathogenesis of the awakening headaches related to the OSA, is probably associated with hypercapnia, vasodilatation, elevated intracranial pressure, and poor sleep quality [43, 44, 45].
Medication overuse headaches (MOH) is also associated with sleep disorders: MOH is a secondary form of headache triggered by the frequent use of acute pain medication for management headaches. MOH is associated with poor sleep quality [2, 3, 9].
The treatment is mainly targeted to relieve pain and associated features of headache. In case of migraine, the treatment has undergone major advances with the development of new specific anti-migraine therapies and more treatments are in development. If not a migraine- specific medication, treatment should be selected based on patient comorbidities, in order to address more than one problem at the same time. Medication should be initiated at the lowest dose with gradual increase of the dose to an effective range, while monitoring the response and potential adverse effects. Treatment, if well tolerated, should be continued for at least 2–3 months, with re-evaluation after that.
Migraine treatment algorithm is mainly divided into pharmacological interventions and nonpharmacological interventions. Among the pharmacological interventions the paradigm of treatment is based on preventative and acute/rescue therapy. Options included on the preventative armamentarium are oral antihypertensive (beta blockers, calcium blockers, ACEI/ARB), anti-depressants (SNRI/TCA), anticonvulsants (valproate, topiramate), Botox injections, CGRP mAB. Options for the acute treatment of migraine include triptans, Dihydroergotamine, Ergotamine, Neuroleptics, NSAIDs, and newer categories of recently FDA-approved gepants (ubrogepants) and ditans (lasmiditan). Among nonpharmacological interventions there are psychological interventions, including cognitive behavioral therapy (CBT), relaxation therapy and biofeedback. Neuromodulation including transcranial magnetic stimulation (TMS), Cefaly device, noninvasive vagus nerve stimulator GammaCore, remote electrical neuromodulation (REM), and acupuncture. Lifestyle modifications, including regular sleep and healthy diet, good hydration, management of triggers and stress management and use of supplements/vitamins, such as magnesium oxide and vitamin B2 (riboflavin) .
Acute treatment for cluster headache is mainly based on high flow oxygen and fast acting triptans, such as Sumatriptan and Zolmitriptan, available in injectable form and/or nasal spray. Inhalation of 100% oxygen by nonrebreather mask at a rate of 12–15 L/m for 10–15 minutes is used as a first line therapy. Acute therapy for cluster headaches requires fast acting routes of administration with subcutaneous triptans as the most effective, followed by nasal and then oral formulations. Neuromodulation with GammaCore—a noninvasive vagus nerve stimulator, which was approved for both acute and preventive treatment of cluster headaches can be used safely multiple times per day, alongside with high flow oxygen. Other approaches for acute symptomatic management include occipital nerve blocks with local anesthetics and/or steroids, sphenopalatine ganglion block, intranasal 4% lidocaine spray or oral steroid taper as a transitional approach. As for prevention of cluster headaches, the drug of choice is verapamil with a total daily maintenance dose between 480–720 mg divided in 3 daily doses with immediate release formulation generally preferred. Lengthening of the PR interval is a feared adverse effect of Verapamil, with doses mainly above 240 mg a day, therefore ECG monitoring is recommended initiation of the therapy, after each dose adjustment, and every 6 months thereafter while on the medication. Other preventive regimens for cluster headache includes topiramate, lithium, melatonin, baclofen and valproic acid .
Among the paroxysmal headaches such as paroxysmal hemicrania, SUNCT (Short-Lasting Unilateral Neuralgiform Headache Attacks with Conjunctival Injection and Tearing), SUNA (Short-Lasting Unilateral Neuralgiform Headache Attacks with Autonomic Symptoms), response to indomethacin is crucial and even included in diagnostic criteria for paroxysmal hemicrania and hemicrania continua. For patients, who cannot tolerate indomethacin other medications have been proposed, including cyclooxygenase type 2 inhibitors, verapamil, and topiramate. For the prophylaxis of SUNCT and SUNA the first line treatment is lamotrigine, followed by topiramate or gabapentin [46, 47, 48].
Treatment alternatives for hypnic headache include caffeine, melatonin, clonazepam, acetazolamide, indomethacin sustained release and lithium carbonate.
Treatment for TTH include pharmacological and nonpharmacological approaches. Simple analgesics, such as aspirin or other NSAIDs, acetaminophen, may be effective if only for a short period of time or if used infrequently. Preventive alternatives for TTH include tricyclic antidepressants (Amitriptyline) or SSRI’s. Some patients respond to nonpharmacological approaches, such as massage, meditation, and biofeedback.