(Caveat: I'm currently on medication that helps with getting off to sleep, and might also be helping me with anxiety/depression, but it's really hard to gauge that side of it. Anyway, sometimes I try these if the effects are wearing off in a morning and my mind starts spinning, and used to use them before being on the medication at night too.)
Breathing exercises sometimes work. The old deep breath, hold for a little too long and then let it go in a measured manner. Two or three cycles and then relaxing / applying some or all of the following might work.
Other times, telling myself that what I'm thinking about can wait until morning / later, basically trying to trigger "save and quit" in my brain. I got quite good at that before the change of medication.
Another weird trick is to convince myself that the room is the other way up and if I don't relax and sink into the sheets and mattress that I'll fall away from the bed onto the ceiling. I know this doesn't make any kind of sense. File it under "so stupid it works (sometimes)".
Practically speaking, try not to be too warm or too cold. A surefire way for me to not fall asleep is to have cold feet. I might not even realise that my feet are cold until I think about it. An electric (under-)blanket that warms both body and feet has proven invaluable, as did the hot water bottle that preceded it.
Finally, if none of these work, get up and do something to distract yourself for a while. Plan to get back in bed 10-15 minutes before a multiple of 90 minutes before the time you've set your alarm. Hopefully, you'll be tired enough to sleep before 105 minutes (15+90) to go, because that's basically the last chance for meaningful rest. Anything less is a short nap and you'll probably be groggy when you wake up.
The next advice you need to seek is how to wake up when you're tired and/or groggy.