What you describe could possibly be sleep paralysis. The next time this happens, there are a couple different options.

1. You can move your facial muscles as those are unaffected by sleep paralysis because of their small size. This will help get you out of sleep paralysis quicker.

2. If it is in fact a dream, you should be able to move around without a problem. Tell yourself that it is a dream, and that you can do whatever you want. Have confidence in that, then try something.
Also, you can close your eyes, and visualize something like a dream scene or a shape which can lead to a dream scene.

Waking up like this can be a great benefit if you can learn to work with the process. Good luck!