That sounds like a very scary nightmare. What do we do if a dream feels real? What if we are frightened that a demon might really be attacking us? A two part answer comes to mind. First, it could very well be our minds playing tricks on us. When our brain chemistry is unbalanced, dreams and reality become confused. Take for example people suffering with alcoholism. We all know that people who are very intoxicated have hallucinations. They might see spiders where there are no spiders. Similarly, unhealthy brains also create hallucinations. For some reason our bodies may stop producing enough healthy neurotransmitters for our brains to function correctly. So, dreams feel more and more real, and reality becomes confused. Then life feels terrifying! When this happens, it is a good idea to see a doctor. There are some excellent medications which can help to restore your brain to normal functioning.
Second, use the scriptures to protect yourself. James 4:7, 8 read, "Submit yourselves therefore to God. Resist the devil, and he will flee from you. Draw near to God, and He will draw near to you." That's a promise! Additionally, always tell the demons to depart in Jesus' name. Mark 9:38 informs us that even people who were not disciples of Jesus were able to cast out demons by using Jesus' name. There is great, great power in Jesus' name. Believe it.