Hello,
For migraine sufferers with obstructive sleep apnea (OSA), continuous positive airway pressure (CPAP) treatment can decrease the frequency of migraine attacks, their duration, and intensity. CPAP does not normally cause headaches unless there is a sinus related problem or some pressure from the machine acting where it should not be.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.
If the pressure is too high or too low(which means it's not effective thus your difficulty getting sleep) a migraine can arise, though it seems rather rare.