In al-ʿAwfī’s commentary, transmitted from Ibn ʿAbbās:
“The knowledge, the sunnah, and the Book I have granted you are worthier than the affair of the Companions of the Cave.”
I say: The matter stands exactly as the early scholars explained. The story of the Companions of the Cave is one of Allah’s signs, for their remaining asleep—yet alive—for three hundred years without dying is a sign that showcases Allah’s power and will, that He creates whatever He wills, contrary to what the atheists claim. It is also a sign attesting to the resurrection of bodies, as the Exalted says: “Thus We caused them to be discovered so that they might know that Allah’s promise is true and that there is no doubt about the Hour” (18:21).
In their time people were disputing whether souls would return without their bodies. The Prophet’s—peace and blessings be upon him—narration of their story, when no human had taught him, is itself a proof of his prophethood. Consequently, their story serves as a sign affirming the three fundamentals of faith: belief in Allah, belief in the Last Day, and belief in His Messenger.
Even so, they are not the most astonishing of Allah’s signs; indeed, among Allah’s signs are things even more wondrous than that.