I have bouts of insomnia, which last longer than the periods of actual good sleep. One thing I use is a form of Melatonin ffrom GNC that is TIMED RELEASE. you don't get the full 3mgs at once.... you get it gradually.
Unfortunately, with the current need to sleep on my back (huge leg brace and need to keep left leg elevated), I don't get to sleep on my left side which is my most normal side. I can sleep partially on my back and partially on my right side, but it ends up being uncomfortable. I also can't sleep in my other favorite position: on my stomach. So, my insomnia is out of control... making me sleepy during the day. Trust me, I can't wait to get out of this brace... but it'll be weeks at this point.
If you have a GNC nearby, try their Timed Release Melatonin... it's the only one that (normally) helps me. the regular ones don't help me at all.