Recently, I learned a trick for falling asleep when conditions are not ideal for rest. (I promise this has relevancy for writing, stick with me.)
Starting with closed eyes, relax the eyes. Feel them deepening into your sockets. Then let go of any tension in your face.
Move on to another part of the body. (I like to start with the feet.) Focus on the muscle group, release it.
I never make it past the feet; by then I’m asleep. If I’m not asleep, I’ve allowed my mind to wander onto something else.
Why this works for me: I stop thinking about trying to sleep, and focus my attention on a single thing.