Hi Bulldog,
Sleep issues, not only sleep apnea, can leave us waking with migraine pain. A CPAP machine is used to treat sleep apnea, which may trigger a migraine attack. I would encourage you to discuss having a sleep study with your doctor to see if in fact there is a sleep issue. The only way I'm aware of getting a CPAP machine is with a sleep study to determine whether or not you have sleep apnea.
Keeping a regular sleep schedule is important for many of us with migraine disease. If we sleep too much or too little, it may trigger a nasty migraine attack, I know it does for me.
The other thing I wanted to mention is there is a type of headache disorder called hypnic headache that occurs each night around the same time between 2 AM - 5 AM. You can read more about that here; https://migraine.com/living-migraine/nighttime-headaches-after-age-50/.
I hope that
Wishing you a low pain day,
Nancy Harris Bonk, Patient Advocate/Moderator