Insomnia – in-the-moment help

I suffer from insomnia – I’ve worked hard with sleep hygiene and routine (maybe too hard? I’ve become rigid to a fault here). I have done some good thought models around my fear of fatigue that I’m continuously working on, but finding it really hard to know how to break the anxiety thought loop in the actual moment of sleeplessness – 2am panic attack. Meditaiton/counting backwards helps me fall asleep if I’m not in the panic-mode, but hasn’t helped if I’m already in full blown panic, which sometimes I wake up with before I can even identify thoughts causing it. If I find myself unable to sleep at 2am and I try to do do thought models – that seems to “rev” up my brain and I find myself more awake than before. The bridging thoughts like “I’m learning to become a person who can handle being awake in the middle of the night” is revving me up for sure. I can see benefits in trying to think “how is this perfect?” or “I can handle fatigue” etc. but they seem to just leave me even more awake pondering them at 2am. I’ve also tried naming the worry emotion and sensations and describing them – but at the end of that I feel more anxious and am having thoughts like “no, I’m actually NOT willing to feel this- it’s terrible!” and then feeling even worse.
Do you have any suggestions for believable go-to thoughts in that moment of panic that can help break the cycle?