I have done the changing the ending thing before, and that helped some in writing them down. Got some interesting short stories out of it too.
Mostly though it's just something I get freaked out from and go about the day freaked out..I'm on a sleep med now though so maybe it will help.
Distractions are my typical go to for immediate relief. I keep my nintendo 3ds by my bed and can play a game for a while till I fall back asleep. Or watch an episode of a cute TV show that's comforting. I like Mythbusters for that for some reason but cartoons are good too. Sometimes I need to turn on a light, other times hiding in a blanket is better.
I hope you find something that works for you.
__________________
dx: ptsd, gad, mdd, panic attacks
rx: prozac, clonidine prn
Clawing my way out of depression.