When we sleep, the brain does not completely disconnect from the outside, but keeps active , more or less slowed down, numerous neural circuits , including sensory systems. It is a security mechanism that has been preserved throughout evolution. Otherwise, we would not wake up to a noise or physical attack.
From a young age, we learn to sleep in a confined space, not before having experienced more than one accident: who has not fallen out of bed at some point in childhood? Even when we lie down in a different bed than usual, the brain quickly "memorizes" its dimensions.





