They tried to guide that shepherd with their convincing...
They tried to guide that shepherd with their convincing arguments but he did not listen. The youths then moved towards the cave. After a while one of them looked back and exclaimed, “Look, the dog of the shepherd is following us leaving his master.” They pelted him with some pebbles to drive it back but it made no difference and the dog continued to follow them. They feared that if the dog barked, it would draw the attention of other people. But see again the Might of God.
The animal spoke in human language, “O God-worshipping gentlemen! What will you gain by hitting me? Please do not fear me, as I will never be dishonest to you. I befriend the true friends of God. You may rest without worrying. I will keep a watch over you.” Now it became quite clear to the youths that it also was a great mercy of God. Never mind if the shepherd did not respond to their selfless admonition here is a dog, which has heard the truth and accepted it. God Almighty guided it.
So they took that dog with them, entered the cave and lay down to rest, as they were very tired. The dog also sat at the mouth of the cave putting its head on its outstretched paws keeping a watch. Summary: The People of the Cave slept restfully. How long, do you think? How many days? How many weeks? How many years…? Three hundred and nine years!
Verily God Almighty had decided to show an example of His Might through these youthful and faithful companions who were shining brightly in a dark environment. Almighty Allah proved that the One who can awaken people hale and hearty after a long sleep of 309 years could certainly make the dead rise after their long sleep and show them what they had done on the Day of Judgment. Verily He is Omnipotent. He kept that cave hidden from the eyes of the world for a long time.
On the other had, when king Daqyanoos came to know that the rebellious youths had fled he sent nine fellows to find them out. The searched for nine years but could not reach the cave. They could not know what happened to the youths. During this long period, sunrays used to enter that cave from its mouth. And you might see the sun when it rose, decline from their cave towards the right hand, and when it set, leave them behind on the left while they were in a wide space thereof.
This is of the signs of Allah; whomsoever Allah guides, he is the rightly guided one, and whomsoever He causes to err, you shall not find for him any friend to lead (him) aright.