When we sleep we are still conscious but not of our surroundings.
It is dream that makes us unconscious
and makes our body at rest. Dreams are like videos in are mind that plays so that we could keep still while we are asleep. Wherein if your dream is cut short there is a tendency for you to wake up making you conscious again. However, dreams can really be dangerous once it is analysed. Some dreams may show predictions for the future and some dreams showcases weird scenarios that may deprived the person from sleeping which we now call insomnia.