Firstly, Allah says that the companions tarried inside the cave for more than 300 years. Momins never doubt He could keep them alive that long. But they must certainly be curious about the means. It is also possible, as Yusuf Ali suggests, that their eyes were open as it happens partially to many of us in sleep. Such a phenomenon of suspended animation is certainly known to happen in nature.
Scientists call it hibernation.
When we sleep everyday we go through five or six cycles consisting of shallow, medium and deep states called alpha, beta and gamma phases. Deeper the sleep, lower are the frequencies and intensity of heartbeat, respiration and blood pressure. Still deeper state occurs under hypnosis but the subconscious becomes well awake and becomes accessible for two-way communication. A far deeper superconscious state is realised in the practice of yoga in which respiration is very shallow and its frequency falls to just about one per minute, heartbeat decreasing correspondingly. Not merely the subconscious, but the soul itself is claimed to become awake in yogi state.