Head pain must be evaluated by a doctor, preferrably much sooner than later. Since it occurs when you're lying down, there's a good chance that it has to do with fluid levels and pressure in your skull and this needs immediate attention from a doctor. I am not a doctor so I may be completely off base, which is why I think you need to contact your doctor's office as soon as they open tomorrow and let them know that this is happening....it may be nothing, but you should never fool around with head pain.
I've experienced the same kind of pain and also mostly while sleeping, or trying to. I had an MRI done and it was diagnosed as arthritis. I've since had some luck with a chiropractor. Best wishes!