I have had these in the past and I reasoned they were so much worse than daytime anxiety or panic because I didn't sense they were coming on like I do in the day so I wasn't at all prepared. Plus it is dark, you've been asleep, everything seems spookier at night, etc. For me, they have occured when at times when I was especially stressed or anxious.
I can't recall what made them go away ... perhaps they did when my anxiety situation improved. Recently I have been taking Magnesium 400mg at bedtime. It is over the counter. It has improved my sleep and relaxation. See WebMD which has a good article about it. Cardiologists use it to help relax the heart, stop palpitations, and lower blood pressure somewhat. Anyway, it works well for me.
I hope your nighttime improves. A good night's sleep sure makes the next day better.