You've probably already read about the basics for getting a good night's sleep.
Things like using your bedroom for sleep and sex only, going to bed and waking up at the same time every day even on weekends, and limiting daytime naps to no more than 20 minutes. The National Sleep Foundation recommends 7 to 9 hours of sleep for adults 18 to 64 years old and 7 to 8 hours of sleep for those older than 65.
Getting to bed at a regular time between 9-11 pm will help keep your circadian rhythm in balance. But we both know how much a migraine can disrupt our regular sleep routine.
Let's have a look at what can help prevent you from getting a migraine from lack of sleep. Good, refreshing sleep.
Doctor Vincent Fortanasce says it's the REM sleep (Rapid Eye Movement) stage that provokes migraines. 
Dr. Fortanasce is a Los Angeles-based neurologist, psychiatrist, and author of the Anti-Alzheimer's Prescription. He says that REM sleep can provoke your most powerful migraine about five to six hours after sleep begins. 
He says that “most of us go through about six sleep cycles with about four stages of sleep, plus rapid eye movement (REM) sleep. The deepest stages of sleep (stages 3 and 4) are necessary for the production of sufficient serotonin and dopamine, both neurotransmitters.
These neurotransmitters are the "feel good" chemical messengers in the brain, and both depend on adequate sleep; a decrease in serotonin and dopamine is associated with poor sleep or sleep problems.
One reason for waking with migraines is that REM sleep is most powerful just before awakening. Sleep problems can then trigger migraines by causing instability of serotonin and a lowering of dopamine levels.
Antidepressants, specifically the selective serotonin reuptake inhibitors (SSRIs), may help stabilize serotonin membranes and block migraines. These medications are sometimes used as migraine treatment.” 
Research has shown that sleep problems such as insomnia, may actually be a trigger for migraines. When a migraine begins, the hyperactive nerve cells will send impulses to the blood vessels telling them to constrict. Along with this constriction comes a release of chemicals in the brain and an inflammatory substance, which actually causes the pain.
In a study on migraine sufferers and their sleep habits, which was published in Headache, showed that there is evidence that good sleep reduces the intensity and the frequency of migraine headaches. With this study, 43 women received behavior sleep instructions or placebo instructions, along with the usual medical care. The results of the study showed that those who received the behavioral sleep instructions reported a significant reduction in both the severity and the number of headaches they were experiencing. 
If you feel that your sleep habits are affecting your migraines, the first thing you should do is keep a log or diary. Make a list of symptoms, when you have a migraine, medications taken, and anything else you feel the physician should be made aware of. How are your sleep habits? Do you have problems drifting off to sleep? Do you wake frequently and if so, is there a particular reason?
Whether a person suffers from migraines or not, poor sleep will definitely affect their daytime function. Not only do poor sleep problems reap havoc on your body, but also on your mood and decision-making abilities, but can also result in fatigue, irritability, malaise, poor concentration, and even accidental death.
No physician or anyone else can guarantee that improving your sleep will actually result in a decrease in your migraines.
There are some practical ways to help with your sleep problems though:
There are things you can do to better manage your sleep problems with your migraine attacks:
If you must watch TV or be on your computer, then consider investing in some glasses that block out blue light - I have these ones - GloFX Red Color Therapy Glasses.
And one last one... if you get a migraine from lack of sleep, pay attention to your sleeping position. Some people feel better with their head raised a little - up on a couple of pillows. Be sure NOT to sleep on your stomach, as this can create neck issues.
The connection between sleep habits and migraines is still being determined.
The REM sleep abnormalities have definitely been implicated in a variety of problems.
If your physician feels that you might have sleep problems such as sleep apnea, restless legs syndrome, insomnia or other sleep problems, he/she might want to do a sleep study or other tests that would help he/she to determine exactly what the problem is.
Common sense, if the problem can be corrected or treated, then your migraines may improve.
If you're up all night, your brain can become irritable and have trouble functioning. This makes you much more susceptible to pain's effects, and that's why it's vital to treat your sleep problems as soon as they arise.
Consistently getting a good night's sleep will reduce your risk of developing more serious neurological conditions and improve your ability to function during the day, your reaction time, and your cognitive abilities, which will in turn improve your quality of life. 
If you get a migraine from lack of sleep, be kind to yourself and have a gentle morning. And attend to the migraine asap with your preferred treatments to abort it.
And learn to relax more. Try my guided mediation for sleep and have a look at my meditation course - here's the link...
Until next time, be well and be pain free,
Migraine From Lack of Sleep Refs:
1. Bruce, D. PhD (2007) Do Your Sleep Habits Trigger Migraines? Available [online] at: https://www.webmd.com/migraines-headaches/features/do-your-sleep-habits-trigger-migraines
2. Levine, Hallie (2017) The Healthy Brain. Expert Tips to Get the Sleep You Need. Available [online] at: https://www.brainandlife.org/articles/adequate-shut-eye-is-good-for-your-brain-our-experts/