Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Nightmares that frighten people and sadden them are from Satan. The Prophet (Sallallahu Alaihi wa Sallam) said: "The good dream is from Allah while nightmares are from Satan. So, if any of you has a dream he/she fears, he should spit on his left hand side and seek refuge with Allah from its viciousness, then it will not cause him any harm". [Reported by Imam Al Bukhari]
So, this Hadith is an evidence that what the person has of nightmares and frightening dreams should not sadden him or frighten him. Some people mention having gone through the same thing you described.
The treatment as we said is to spit on the left hand side and seek refuge with Allah from Satan. To prevent this, one should always recite Al Kursi Ayah (Quran 2:255) before sleeping, as this verse protects from Satan.
Allah knows best.