Back in college when my sleep schedule was bonkered because of rotating class schedules (8AM MWF and Noon TTH for first class) combined with partying and reffing hockey on the weekends which meant that I could be out at the rink from 5PM to midnight on Sunday night, I figured out a few things that "worked".
First of all, cut the caffeine after noon, unless you need to pull an all-nighter. I guess for you, this would mean cut the caffeiene after... 10PM?
Now, onto the melatonin: I had similar results to yours. To remedy this, I would have half of one at bedtime with about a gallon of water. This had 2 effects: one, a lot of fatigue is caused by dehydration, so it stopped any chance of that, and two, it caused me to wake up in the middle of the night to pee. When I peed, I would take the rest of the melatonin. Worked for me, might for you, I dunno.
Now, more stuff that you didn't ask for: Sometimes when the melatonin wasn't going to cut it, I took nyquil. Knocks you out. They now sell Zquill, which is the same thing, but just with the sleepyness stuff. No idea on long term effects, probably not good. I used it sparringly (but I used the medicated version because Zquill wasn't invented yet).
I am not a doctor and do not endorse any of these. YMMV. Use at your own risk. The following I do endorse though:
No "artificial" light before bed. 30 minutes at least. That means no cell phone, no computer, no tv, no tablet. Turn it off or put it away. They engrain patterns in your eyes and brain and it takes longer to reach deep sleep because of it. Look up the sleep study's, I am not making this up. Read a book or a magazine right before you hit the sack and you'll fall asleep faster.
Lastly, I read or heard somewhere that the hormones released after sex are more powerful than valium. So tell the wife that you need it or you'll lose your job. Even if that isn't true, who cares?