Logical Deer and Mash's advice are brilliant. If over time this doesn't help, it may be worth finding a counselor to talk it out with. They can teach you how to deal with it until you can stop it.
.
Just quickly adding on to what Mash said, do look at your hands and do count your fingers. Do some research on lucid dreams and then go to sleep. I did that and when I did, I realized I was dreaming in a dream. I looked down at my hands and one had an extra finger and one had a ying-yang in my palm. From there, you can take total control of the dream. This might really benefit you in combating your terrifying nightmare. xx