You've been lying there telling yourself to go to sleep for forty minutes, and it is working exactly as badly as it sounds.
Sleep is one of a small handful of things you cannot do on purpose. You can't decide to sleep any more than you can decide to blush, or decide to find something funny. You can only set up the conditions and get out of the way.
Trying is a form of effort, and effort wakes you up
Falling asleep needs your arousal system to wind down. Trying is the opposite of winding down: you're monitoring yourself, checking whether it's working, doing arithmetic on the hours you have left. All of that is mental work, and mental work keeps the system up.
Every check on whether you're asleep yet is proof that you aren't, and a small dose of alertness on top.
Researchers who study long-running insomnia describe this as sleep effort: the point where wanting it becomes the thing preventing it. It's also why the problem so often outlives whatever started it. The bad week is over, but the trying stayed.
The bed learns
There's a second loop underneath. If you spend enough hours awake and frustrated in bed, the bed stops meaning sleep and starts meaning being awake and frustrated. Your body reacts to the room before you've even lain down — which is why some people are fine on the sofa and wide awake the moment they move to the bedroom.
What actually helps
The counter-move sounds absurd and is well supported: stop trying. Lie there and let yourself stay awake on purpose, with no goal of sleeping. Take the target away and you take the effort away with it.
And if you've been awake a while, get up. Somewhere dim, something dull, back to bed only when you're properly sleepy. It feels like losing time. It's the fastest way to teach the room what it's for again.
Don't look at the clock. Nothing it can tell you helps, and every reading is another sum to do.