I have tried to stay there in bed and toss and turn trying to get to sleep. It makes it worse, the harder you try the more you toss and turn.
I find it is when you are trying to work out something that has happened during the day, you are looking for an answer.
I get out of bed now, get a piece of paper and a pen and write out what I am thinking about. Give some short answers to the problem.
I find if you actually sit and write out what is bothering you, you will then be able to go back to bed and sleep.
It is almost healing. I have done this many times and it does work, believe it or not.
You have nothing to lose.