When something or anxiety wakes me up in the middle of the night and I can’t go back to sleep, I start doing math (usually multiplication tables and division)in my head.
Focusing my mind on the math allows me to slow my breathing and let the intruding thoughts flow through and out my head. Give it a try and let me know if it helped you.