Hello!
As someone who’s recovered, I can completely relate to your story and I’m telling you that worrying unnecessarily over bad sleep is what’s causing your sleeplessness, which by itself, isn’t a problem. But you thinking there’s a problem as if your life or death depends on it and your subsequent over-reaction, that becomes the problem in itself. Your impatience in trying to fix this quickly and the frustration over how long it’s taking makes the problem persist indefinitely.
Very often, you can fix this by just having a fixed bedtime schedule, ie getting into and out of bed at the same time everyday and no sleeping at other times, enjoying your day the best you can and being very patient with yourself because full recovery isn’t going to happen overnight but slowly over weeks sometimes months depending on your personality and how accepting you are of your situation. At times you are just going to accept defeat and say “Insomnia, you win. I won’t try to fight you anymore because it’s futile.” Accepting that bad nights will happen no matter what you do, that worrying about them isn’t going to help and will instead make it worse and avoid taking measures to improve sleep and stop questioning too much what and why this is happening, is crucial. Just accept what your body is going through and do nothing for sleep except having a regular bedtime routine will ensure you don’t have to suffer longer than necessary.
Accept that sleep is just a number game, most people feel sleepy after being up for at least 16-18 hours and by not getting in the way of sleep with excessive worry and anxiety (these will take time to go away so please be patient with yourself), most people including you will eventually sleep well again. If you find you can’t sleep well initially, don’t be so hard on yourself because this is normal and you can either get up and do something enjoyable or just have an early start to your day. Over time your sleep will improve and you find yourself spending more time in bed asleep. Good luck and best wishes.