“Anything that gets you out of your normal routine can cause a headache, because the ‘migraine brain’ likes to be as steady and stable as possible,” says Dr. Hamilton. Research suggests that the association between migraine and sleep is bidirectional. Headache can cause disturbances in sleep, and sleep problems can trigger a migraine attack, according to a review published in January 2018 in Therapeutic Advances in Neurological Disorders. The good news is that good sleep habits are one of the most effective tools for managing migraine, says Lauren Doyle Strauss, DO, a headache specialist and assistant professor at Wake Forest Baptist Health in Winston-Salem, North Carolina. In some individuals, improving sleep hygiene can lead to improvements in migraine in just a few months or less, according to the American Headache Society. Here are six tips to try for a better night’s sleep.

1. Stick to a Regular Sleep Schedule

Not getting enough sleep and sleeping too much can both be headache triggers, according to the American Migraine Foundation. The organization recommends getting between seven and eight hours of sleep each night. When possible, try to go to bed and get up at about the same time each day, suggests Hamilton. “Irregular sleep and wake times increase your chances of a migraine attack,” she says. Avoiding naps can help you sleep better at night, says Dr. Strauss. This isn’t always easy, because sometimes sleep is the only thing that can help people during a headache, she says. “The issue is if you’re taking excessive naps during the day, that makes it harder to go to sleep at night. Try to limit daytime sleeping and move all your sleep to the night and keep the same bedtime,” she says. Bedtime rituals such as taking a warm bath, reading, listening to calming music, doing yoga, or praying can help you fall asleep, according to the American Migraine Foundation. “This means no TV, digital screens, or eating in bed,” Dr. Rosen says. Rosen recommends a cool, dark, and quiet room for sleeping. “Use humidified air in the bedroom during winter months, and weighted blankets or specially designed pillows if these help you relax,” he says. Keep your bedroom uncluttered, and try blackout curtains if you are light sensitive, the National Sleep Foundation suggests.

3. Turn Off Electronics an Hour Before Bed

It’s not just a busy mind that keeps people up at bedtime. Rosen says the blue light from the television, smartphones, and tablets upsets the circadian rhythm (your body’s natural sleep-wake clock) and causes the brain to wake up, making it difficult to fall asleep. He recommends shutting down all electronics an hour prior to bedtime.

4. Avoid Caffeine, Alcohol, and Meals Too Close to Bedtime

Rosen recommends paying attention to how your diet and fluid intake affect your sleep. To improve sleep, he suggests the following:

Avoid alcohol if it causes you to wake up after falling asleep.Avoid caffeine after a certain hour (this varies from person to person).Don’t have a full meal too close to bedtime.Limit your fluids after a certain hour to avoid having to use the bathroom at night.

5. Practice a Relaxation Technique

Many people who have migraine have difficulty falling asleep, according to Rosen. He tells his patients to build relaxation skills with regular exercise, deep abdominal breathing, and biofeedback. “There are many studies being done now on mindfulness and headache,” says Rosen. Practicing yoga positions while being mindful before bedtime may be just what the doctor ordered to quiet an active mind and manage migraine. Yoga nidra, a form of guided meditation that is practiced lying down, may be the most relaxing type of yoga. A monthlong study published in September 2020 in Current Psychology found that people who practiced an 11-minute yoga nidra meditation showed lower stress, greater well-being, and improved sleep quality compared with a control group. Free yoga nidra recordings in a variety of languages can be heard on the Yoga Nidra Network website. RELATED: What Is Mindfulness and How Can It Help Your Health and Wellness?

6. Be Cautious About Sleep Aids

Rosen approves of short-term use of sleep aids — medications and herbs that can make you drowsy — especially if your sleep becomes fragmented with age. “The over-the-counter natural supplement melatonin works for sleep training, but you have to find what works for you,” he says. That said, he reiterates that he supports only “short-term usage” of any sleep aid.

Tried Everything and Still Can’t Sleep? You May Have a Sleep Disorder

Although you can solve many sleep problems by changing your habits, a sleep disorder like snoring, sleep apnea, restless legs syndrome, or chronic insomnia may require the attention of a medical professional or sleep specialist. People living with migraine are between two and eight times more likely to experience sleep disorders compared with the general public, according to the American Migraine Foundation. Those with chronic migraine — 15 or more headache days a month — report twice the rates of insomnia as those with less frequent headaches. “Poor sleep is a common trigger for migraine headaches,” Rosen says. “There is good evidence that sleep disrupters, like snoring and sleep apnea, are linked to chronic migraines.”

Snoring and Sleep Apnea

While your bed partner’s snoring may cause you to get fragmented sleep, your own snoring is a risk factor for chronic daily headache. Snoring is often a sign that you have sleep apnea. Sleep apnea is a potentially serious sleep disorder in which breathing repeatedly stops and starts. Snoring loudly and feeling tired after a night’s sleep are warning signs for sleep apnea. “People at risk for obstructive sleep apnea are usually overweight and have a short neck,” Rosen says. “With central sleep apnea, on the other hand, the brain doesn’t tell the breathing to ‘drive’ at night. The problems with sleep apnea arise when oxygen levels drop below 90 percent during sleep, which can injure brain cells.” According to Rosen, right now, it’s not clear that length of sleep matters as much as sleep quality when it comes to chronic migraine. This is a wake-up call for those who get 12 hours of sleep and still do not feel refreshed. Independent of obesity, Rosen says treating snoring and sleep apnea may help chronic migraine, especially in people who wake up with a headache.

Restless Legs Syndrome

Restless legs syndrome, which is defined by the American Sleep Association as a sensory disorder causing an almost irresistible urge to move the legs, is another sleep disorder that is more common in people with migraine, according to an meta-analysis published in Pain Research and Management in August 2020. “Treating the restless legs may improve chronic migraine,” says Rosen.

Insomnia

“Insomnia, which causes difficulty falling asleep and difficulty staying asleep, may affect sleep quality and duration and trigger migraine,” says Rosen. In addition to improving your sleep hygiene, many experts recommend cognitive behavioral therapy for chronic insomnia (CBT-I). This evidence-based therapy can help people with insomnia fall asleep faster, sleep longer, and improve sleep quality, according to a meta-analysis published in August 2015 in Annals of Internal Medicine. People who practice CBT-I learn how to identify thoughts or habits that can negatively impact sleep and replace them with behaviors that are more likely to promote good sleep. Additional reporting by Becky Upham.