When this happens in a dream, try to remember that you are in a dream. If you remember, stay calm and try to control your dream. If you cant do this, just go with it. Struggling while paralyzed is hopeless, accepting that its a dream and you have no control, might help with the fear.en.m.wikipedia.org/wiki/Lucid_dream Some info on the topic.
Don't try to wake yourself up from nightmares, because you may wake up still dreaming.