As if being in pain weren’t difficult enough, many people living with migraine have issues with poor sleep quality.

Migraine causes fatigue, and inadequate sleep contributes to that problem. And those with chronic migraine are even more likely to experience snoring, sleep apnea, and an inability to get enough sleep to feel fully rested.

People living with migraine often combat insomnia, depression, and anxiety. These conditions may go hand-in-hand in a vicious cycle where difficulties with sleep cause headaches, and headaches in turn result in poor sleep.

For years, I dealt with terrible insomnia and “painsomnia” (pain + insomnia) as a result of migraine, where my pain and symptoms would make falling and staying asleep almost impossible.

Learning healthy sleep habits can make you sleep better and stay asleep. These habits are a pillar of cognitive behavioral therapy, which is one of the most effective forms of long-term care for people with chronic insomnia.

Through conversations with my doctor and pain psychologist, I was able to implement better sleeping habits that helped reduce the number of nights lost to insomnia and days spent with disabling fatigue. I hope these tips can help you, too.

Setting a time in which I go to bed every night and wake up every day — even on the weekends — keeps my body’s clock regulated.

I tend to fall asleep much easier because I’m ready for bed by the time the “Do Not Disturb” mode is activated on my phone.

Here are 12 ways to fix your sleep schedule.

Choose a routine activity to do before bed that’s also relaxing. Try to do this activity away from any stimuli such as bright lights, loud noises, or anything that can make you feel excited or stressed.

Every night, I do a bedtime meditation or listen to a sleep story on the Calm app. It helps to melt away stress, tension, and anxiety, and makes falling asleep a piece of cake.

My headache specialist told me that naps were no longer allowed when going over my sleep hygiene.

Although those 20- to 30-minute naps helped me get through the day, they interrupted my ability to fall asleep at night.

So, if you have trouble falling asleep, you may have to stop napping altogether.

Exercise can cause exertion headaches for many of us who have migraine — myself included. That means vigorous exercise is out of the question for me.

However, incorporating some exercise into your day can help you sleep better at night. Just don’t do it right before bedtime.

Walking, swimming, gentle yoga, tai chi, and working out on the elliptical or stationary bike are all great ways to exercise without overexerting yourself.

Is your room suitable for sleeping? Take an inventory of your bedroom to see what your sleep environment looks like.

Are there a lot of electronic devices? Is the room too hot or too cold? Is it too bright? Are the mattress and pillows comfortable and supportive? Do the dogs sleep in the bed? Does the TV stay on all night?

Taking stock of what’s going on around us while we sleep is important. Here are some ways to establish the right conditions for sleep:

  • Keep your room cool, between 60–67°F (15–19°C).
  • Remove any noise that can disturb your sleep.
  • Use blackout curtains or shades to block out any trace of light.
  • If your mattress is older than 9 or 10 years, buy a new one.
  • Make your room attractive and inviting for sleep.

Learn more about the best affordable memory foam mattresses here.

Do you go to bed with your phone or tablet or need the television on in order to fall asleep? If you do, then it’s time to break up with your devices before bed.

The light that’s emitted from those particular screens keeps the brain active, making falling asleep much harder. Your body needs time to wind down and shift into sleep mode.

So for that last hour before bed, put your devices away and turn off the TV. Try reading a book or listening to a calming meditation. Let this be your nightly “wind-down hour.”

If all else fails, speak with your doctor. Keeping a sleep diary can help you keep track of any patterns or issues with your sleep and sleeping habits.

Having frequent migraine attacks can be difficult on your sleep routine. However, there are steps you can take to help you fall asleep and stay asleep.

Talk with your doctor if your sleep doesn’t improve or if your migraine attacks interfere with your everyday life.

Jaime Sanders is the author of the award-winning blog The Migraine Diva. She’s a member of the Coalition for Headache and Migraine Patients and Headache and Migraine Policy Forum. Jaime works with the Society for Women’s Health Research Migraine Network and sits on the patient leadership council of the National Headache Foundation. Through her advocacy work and blog, Jaime’s mission is to make a very invisible disease visible to the rest of the world and validate the real pain of millions. Reach her on Facebook, Twitter, Instagram, and YouTube.