Getting enough sleep is an important part of staying healthy. As you sleep, your body repairs itself so that your brain and body can function optimally when you’re awake. But did you know that getting a good night’s sleep can also help keep headaches at bay?

That’s what experts say. Various studies have linked a lack of sleep to two different types of headaches: migraine and tension headaches.

Migraine headaches can cause significant and sometimes disabling headache pain. Symptoms include:

  • pain usually on just one side of the head
  • pain that lasts hours to days
  • sensitivity to light and sound
  • nausea
  • vomiting

Tension headaches tend to cause mild to moderate pain across the top, sides, and back of the head, and aren’t usually worsened by light or sound.

Research suggests that other types of headaches, such as cluster, hemicrania continua, and hypnic headaches, can occur during sleep. But future studies are needed to understand if they are linked to a lack of sleep like migraine and tension headaches.

In 2011, researchers from Missouri State University published a study suggesting that a lack of REM (rapid eye movement) sleep is linked to more painful headaches. REM sleep happens in 90- to 120-minute intervals throughout the night and gets its name from the rapid eye movements that occur during this phase of sleep.

This sleep stage is also characterized by:

  • increased dreaming
  • body movements
  • faster breathing
  • increased heart rate

Scientists believe REM sleep is necessary for storing memories, learning, and regulating mood.

The researchers of that 2011 study found that a lack of sleep increases the creation of proteins in the body that cause chronic pain. It appears that these proteins reduce the body’s threshold for experiencing pain and can spark intense migraine headaches.

A 2018 review closely links a lack of sleep to tension headaches.

There’s growing evidence that a lack of sleep can reduce the body’s pain threshold.

A 2015 study found that people with insomnia and other sleeping issues appear to be more sensitive to pain than those who don’t experience these issues.

Researchers asked people to place one hand in cold water and keep it there for 106 seconds. Those with insomnia were more likely to remove their hand from the cold water than those without insomnia. People with both insomnia and chronic pain seemed most sensitive to the cold water, because they had the lowest pain threshold.

Insomnia can make it difficult to fall asleep or can cause you to wake up early and not be able to fall back asleep. Anything less than seven hours of sleep is considered short for most healthy adults, who need seven to nine hours of sleep each night for good health.

Here’s how much sleep a person needs at each age:

AgeHours of sleep needed
newborn to 3 months14 to 17
4 to 11 months12 to 15
1 to 2 years11 to 14
3 to 5 years10 to 13
6 to 13 years9 to 11
14 to 17 years8 to 10
18 to 64 years7 to 9
65 or more years7 to 8

Other conditions that may cause lack of sleep include:

  • snoring
  • stress
  • anxiety
  • depression
  • sleep apnea
  • tooth grinding
  • jet lag
  • using the wrong pillow

Just as there is evidence that a lack of sleep can contribute to headaches, too much sleep can also cause headaches.

If you do get a tension or migraine headache from a lack of sleep, seeking treatment right away can help reduce its duration and severity.

Tension headache treatment

Both over-the-counter (OTC) and prescription medications can reduce discomfort when a tension headache strikes. These include:

  • pain relievers such as aspirin (Bufferin), ibuprofen (Advil), and naproxen (Aleve), among others
  • combination medications that contain a pain reliever and a sedative, which are often marked with “PM” or “nighttime” on the packaging
  • triptans, which are prescription drugs used to treat migraines

To prevent recurring tension headaches, your doctor might prescribe the following:

Migraine headache treatment

Migraine headaches tend to be more severe than tension headaches, so treatment is a little more aggressive. If you have a migraine, the following prescription and OTC medications may alleviate your symptoms:

  • Pain relievers such as aspirin (Bufferin), acetaminophen (Tylenol), ibuprofen (Advil), and naproxen (Aleve) may ease mild migraine pain. Medications that are specifically designed for migraines combine caffeine with aspirin, such as Excedrin Migraine, and may be helpful for moderate migraines.
  • Indomethacin can relieve migraine pain and is available as a suppository, which can be helpful if you’re too nauseous to take oral medication.
  • Triptans can help block pain pathways in the brain. They do this by binding to serotonin receptors, decreasing blood vessel swelling. This type of medication is available as a prescription pill, nasal spray, and injection. Treximet, a single-tablet dose of triptan and naproxen, is very effective at reducing migraine symptoms in most people.
  • Ergots are a type of medication containing the drug ergotamine and are often combined with caffeine. This combination eases pain by constricting blood vessels. They are effective at reducing migraine pain lasting for more than 48 hours and are most effective when taken right after symptoms begin. Dihydroergotamine (Migranal) is a type of ergot medication that tends to have fewer side effects than ergotamine.
  • Anti-nausea medications such as chlorpromazine (Thorazine), metoclopramide (Reglan), and prochlorperazine (Compazine) can help.
  • Opioid medications, including those that contain narcotics like codeine, are often used to treat migraine pain in people who can’t take triptans or ergots. These medications tend to be habit-forming and aren’t recommended for long-term use.
  • Glucocorticoids such as prednisone and dexamethasone can provide some pain relief.

The following medications may prevent headaches in people who have migraines that last 12 or more hours four or more times a month:

  • Beta-blockers, which decrease the effects of stress hormones in the body, can prevent migraines.
  • Calcium channel blockers, often used to treat high blood pressure, may prevent migraines that cause vision problems.
  • Another medication often prescribed for high blood pressure, lisinopril (Prinivil, Zestril) may reduce the length and intensity of migraine headaches.
  • The tricyclic antidepressant amitriptyline can prevent migraines, and another depression medication called venlafaxine may also reduce migraine frequency.
  • Anti-seizure drugs may reduce migraine frequency.
  • Injections of Botox into areas of the forehead and neck may help treat chronic migraines in adults. These injections may need to be repeated in three months.
  • Erenumab-aooe (Aimovig) blocks the activity of a specific type of molecule involved in causing migraines. This medication can be injected once a month to help reduce migraines.

Here are a few things you can do to manage your tension headaches at home:

  • Reduce your stress levels through exercise, relaxation techniques, or therapy.
  • Apply a hot or cold compress to your head for 5 to 10 minutes at a time. This can help ease pain.
  • Try acupuncture or massage.

The following may also help alleviate migraine symptoms at home:

  • relaxation techniques
  • rest in a dark, quiet room when you feel a headache coming
  • application of a cool compress to the back of your neck and gentle massage of the painful areas on your forehead
  • acupuncture
  • cognitive behavioral therapy
  • supplements, including vitamin B-2, coenzyme Q10, and magnesium

One of the easiest ways to prevent headaches is to maintain a healthy sleep schedule. Here are 10 tips to maintain good sleep hygiene:

  1. Regular exercise can help you get a good night’s sleep. But exercising too close to bedtime can keep you up at night. Try to exercise at least three hours before bed.
  2. Eat lightly at night. This can help you avoid indigestion or an unexpected energy rush that will keep you up.
  3. Sleep on a schedule. Going to bed and waking up at the same times every day can help your body get enough sleep and wake up feeling more rested.
  4. Make sure you get enough light during the day. A lack of light can make you feel more tired and can interrupt your wake-sleep cycle.
  5. Avoid stimulating substances like alcohol, nicotine, and caffeine four to six hours before bedtime. These can keep you awake at night and ruin your sleep.
  6. Make your bedroom optimal for sleeping by keeping it dark, cool (but not cold), quiet, and comfortable.
  7. Remove anything from your bedroom that might interrupt your sleep or make you stressed before bed. This includes electronics like TVs, work materials, and computers. Keep your bedroom activities limited to sleep and sex.
  8. Create a bedtime routine. Getting into a good pre-sleep routine can help relax you for a good night’s sleep. Avoid any electronic screens a few hours before bed. Instead, read a book, meditate, or take a bath.
  9. Go to sleep when you’re tired instead of forcing yourself to sleep. It’s worth waiting an extra 30 minutes or an hour to hit the bed if you’re not yet tired at your usual bedtime. Going to bed and not falling asleep can lead to stress and frustration.

10. Don’t drink too much before bed. Try to taper off your fluid intake so you’re not disturbed by the urge to visit the bathroom during the middle of the night.

Scientists have found a clear link between a lack of sleep and migraine and tension headaches. It appears that a lack of sleep reduces the body’s pain threshold, making it more prone to headaches.

However, different medications, home treatments, and good sleep hygiene can help prevent and treat these headaches. Talk to your doctor to see which treatments might be most effective for you.