I have also had that and it was really, really horrible. I got through it in the end without using any meds but I still wake up in a shock from time to time, but thankfully not all the time. The thing that helped the most was calling a friend who was luckily for me someone who likes to stay awake all night and sleeps in the day. So whilst I was in my worst moments she was always there for me. At times my breathing was so panicked I really thought I was going to die, so not being alone was important. I went many days without sleeping more than 5 or 10 minutes at a time. Horrible. I did also call the crisis line from time to time. I don't know if you have anyone you can call so late in the night when you have this problem.. but for me that was the only thing that helped. Maybe you could make yourself a list of numbers like the samaritans and just keep your phone by you at night. Usually after 10 minutes of human contact you might be able to try to sleep again. If it happens again, ring someone again.
Also, I know that a good sleeping pattern is important, but if you lose too much sleep than at a certain point it is just important to get some sleep no matter what time of night or day it is. I know for me if I lose too much sleep it becomes even hardly to fall asleep and my anxieties become more magnified. People also told me that eventually I would become so exhausted I would just sleep, but that doesn't happen for me, I become more and more aggitated and panicked and hyperalert to every sensation. Really finding some company and being somewhere safe is the only chance I have at those times. Maybe call a friend a short time before bedtime to talk to... just to remind yourself that you are connected and safe.
Just my ideas from my own experience, I don't know if it will help you or not.