I'm f'ed as are probably a lot of people who have anxiety or have ideas that wake them up.
How the heck is a person meant to stop that? :(
At night your reasoning abilty is massively impaired by melatonin. Thats why your thoughts keep going in circles and one does not find the most obvious solutions for a problem. There is only one thing to do. Let it go. You are at your worst, you're not supposed to reason right now.
This simple fact fixed crushing night thoughts for me and a friend of mine.