What do you do if you can’t sleep at night?

I use a technique in which I close my eyes and imagine a scenario or fantasy that I have. Most of the time, it’s nonsense like what I’d do if I had the ability to control time and who I’d screw over with it. Or I’d make up scenarios like how I’d rob a bank and shit. You end up falling asleep once you get into it.