This is my first ever post on this forum and I felt compelled to join just to respond to this thread. While I may not know how to prevent lucid dreaming, seeing as though I have still yet to perfect it, I would suggest advice along the lines of what everyone has pretty much been saying. You should definitely use some "control mechanisms" to keep yourself in the dream, but if you happen to wake up and find yourself in SP do not worry.

Personally, I have had numerous SP episodes in one night - even upwards of five or six attacks within a period of a couple hours. I am not sure whether or not this is stress related or the fact that I am half asleep when it happens, but I have found a solution to SP that helps me a great deal.

I find that it's the best if you just try to calm yourself down as best as possible. The best way for me is to start talking to myself in my mind. I will just start soothing my mind by saying: "It's not really happening, its just a dream, relax, just relax" and I find that if I concentrate really hard on controlling my breathing, taking deep breaths and saying these words to myself, then my mind does not have the opportunity to continue panicking. Kind of like you will occupy your mind and you will no longer be effected by any visions or hallucinations.

The first couple of times I had sleep paralysis, I would freak the heck out because I would surely hear footsteps and imagine an entity getting closer to me and kind of just sitting there, but it was an OVERWHELMING sense of danger and it is a very eerie and unpleasant feeling. I totally understand, but the sooner you learn to accept it and control it, the easier it will become to overcome. Remember, just focus on your breathing and telling yourself it's not real and your mind wont have the chance to really develop hallucinations.

Hope my wall of text helps lol