I experience/d this, mine was due to the mental anguish brought on by having cancer. I called it developing negatives in the darkroom. I still have an episode every now and then and I'm 6 months out of treatment. The mind just starts down a negative path and keeps going and all those horrible thoughts just keep me awake.
Morphine helped a little but not much, it mainly just made me tired. Faith seems to help me the most, but we shouldn't get in to that here.
I doubt this helps you at all, I just wanted to let you all know you aren't alone.
Tim