Hi jms!
With your headaches (are they headaches or migraines?) do you have any other symptoms such as tinnitus (ringing in the ears) or hearing your pulse in your ears?
Check out our article on Intracranial Hypertension (formerly called Pseudotumer Cerebri) and see if any of the signs fit you. The only way to test for IIH is by a lumbar puncture.
This could explain the pain becoming worse when you lay down, due to the spinal fluid around the base of the skull.
Feel free to come back and ask questions and let us know if we can be of more help.
Good luck!