I hear you - I stay up all night about once a week. Thankfully I do not have nightmares - I think the last vivid and horrible one was about ten years ago? I just stopped fighting it - I will eventually sleep, maybe not when I would like it to happen, but I will eventually sleep all night long. I found that "trying to sleep" was far more stressful then the not sleeping, hence my choice. I have an insane level of intolerance for laying flat and "trying to sleep" I find that quite maddening and it feels like being held captive.
Typically I stay up the one night, get a ton of stuff done I have been putting up, stay up the following day sort of mellow since so much was done and go to bed early the next night. I take like six meds a day now and adding one more is just one too many.
This works for me, your results may vary.