I don’t think very much about this is actually know in detail. If it were, the nature of the modern internet would have turned the information into a “viral” something or other.
The nature of sleep itself, although under study for centuries now, is still a mystery for the most part. We know that it appears to be necessary, but only to MOST people. How people experience sleep varies tremendously from one person to the next, and varies tremendously from one experience of it to another, within the life of each individual.
The phenomenon know as “sleep paralysis” is no doubt related to this. It isn’t well understood either, and there are lots of intriguing experiences that various people have had with it.
I have informally studied my own sleep experiences for six decades now, and I KNOW that none of my senses are “shut off.” What does happen, is that my mind can and does make specific decisions about what to attend to. I know, because although I only dream some of the time, that if outside stimuli occur WHILE I am dreaming, that whatever version or portion of my mind is actively deciding what to attend to and how, will incorporate the external stimuli into my dreams.
I’ve taken to referring to that portion of my mind as “the Dream Guy,” who is in charge of running “me” while I am asleep. He has his own ideas as to whether to allow me to wake up for things. One of my favorite illustrative experiences, was a dream I had which was lots of fun, and very involving, in which I was sort of a classic James Bond sort of person, in the middle of a mission. At a critical moment, as I was trying to work out a serious concern in the dream, a loud ringing sound began. My dream “narrator” explained that there was a phone ringing, but that it wasn’t for me, since I was in someone’s office, trying to gather information, so I should ignore it. But the ringing went on without stopping and starting, so my dream character said “wait, that doesn’t SOUND like a phone!” But the narrator rushed back into action and adjusted the dream, to report that “it is a phone ringing, and it’s not for you, but this particular phone is defective, so it rings continuously instead of intermittently, so you should still ignore it.” Finally, another part of my mind stepped up, and actually still within the dream, stated firmly that no, this sound was probably my alarm clock, and that I should set the dream aside for another time, and get up for work.
Lots of physical sensations have similarly been explained away within dreams, which is why SOMETIMES it takes only a light touch to wake me, and SOMETIMES it takes something close to an earthquake.
Clearly, this all means that sleep is not at all purely mechanical. Also, that consciousness isn’t a binary state, it is a continuum.