First of all, Welcome to the Migraine Board. Having had migraines for 30+ years now, I'm pretty well versed in headaches and pain meds. My guess is that you have gotten yourself into a condition called "rebound" headaches. If you take prescribed pain medication and/or over-the-counter(OTC) medication more than two days a week, you are overdosing your system, so your pain receptors don't get any benefit from the medication. Thus, you have a headache everyday, and you try to medicate them away. It is just a viscious cycle. They only way to stop the cycle is to stop taking the pain meds and after a week or two, your system should be cleared out. Suffering through this is by no means pleasant. However, after cleaning out your system, your meds should work again if you only take them occasionally and as prescribed.
As far as the sleeping problem, see if you can get your doctor to prescribe something like Trazadone, a mild anti-depressant, which will make you sleepy. I take it most nights, but it isn't addictive like specific sleeping pills. It won't keep you from dreaming, but it might help to have more pleasant dreams.
Hope this helps and let us know how you are doing.