Waking up in the middle of the night sweating with fear is no way to have a good night's sleep.
Food has been found as a big trigger behind nightmares, so if you snack or have dinner late in the evening, you might find yourself awake at 3 a.m. Lying down with a full stomach can cause acid reflux, which can disrupt sleep and cause discomfort subconsciously. Ideally you should stop eating as early as you can in the day and if you need some help snoozing, try sipping tea before heading to bed.
Alcohol and late night boozing could also be the reason you have a bad dream, as alcohol suppresses rapid eye movement (REM) sleep. This is the period during which a person dreams, and as your body starts to stabilize your dreams can come back in full throttle, and not always in a comforting manner.
Or perhaps you decided to stumble back to your friend's house last minute after a night on the town. Waking up somewhere new or forgetting where you are can cause extreme anxiety, which could lead to confusion in your dreams as well.
Stress as a whole plays a huge part in nightmares, with previous research noting that 71 to 96 percent of people with post-traumatic stress disorder (PTSD) suffer from nightmares. Even the lead up to a big event or something that requires a lot of responsibility can fill us with dread and make us uneasy, which leads to a disruptive sleep. Meditation could help put your mind at rest, or try wearing a bed mask and ear plugs to block off noise.
If nightmares continue to persist, seek professional help as there may be more to them. Some medications that act on neurotransmitters, like anti-depressants, have been linked to nightmares too, so don't let the problem go untreated.