The Prophet ﷺ said that three men among people of long ago set out to seek provision for their families. Rain overtook them, so they entered a cave, and an overhanging rock fell across its mouth until they could not see even a chink of light through it.They said to one another, "The rock has fallen, our tracks have been wiped away, and no one knows where you are except Allah. So call upon Allah by the most trustworthy of your deeds."One of them said, "Allah, You know that I had two parents, and I used to milk the animals for them into their bowl and bring it to them. If I found them asleep, I would stand at their heads, unwilling to drive their slumber from their heads, waiting until they woke, whenever they woke. Allah, if You know that I did that only hoping for Your mercy and fearing Your punishment, then relieve us."A third of the rock moved away.The second said, "Allah, You know that I hired a laborer to do a piece of work for me. He came asking for his wages while I was angry, so I rebuked him harshly. He went off and left those wages behind. I gathered them and invested them until they became a great deal of wealth. Then he came asking for his wages, and I handed over all of it to him. Had I wished, I could have given him nothing but his original wage. Allah, if You know that I did that only hoping for Your mercy and fearing Your punishment, then relieve us."Two thirds of the rock moved away.The third said, "Allah, You know that a woman attracted him, and he offered her a payment. Then, when he had her in his power, he spared her honor and let her keep the payment. Allah, if You know that I did that only hoping for Your mercy and fearing Your punishment, then relieve us."The rock moved away, and they came out walking briskly together.
قال عبد الله حدثنا أبو بحر حدثنا أبو عوانة عن قتادة قال عبد الله عن أنس فذكر نحوه
Its isnad is sahih. Haythami said in 8/140, "Its narrators are the narrators of the Sahih." It is in the Sahihayn in full. Bukhari related it in 4/449, no. 2272, in Fath, in the chapter on hiring, "Whoever hires a worker and leaves his wage," and Muslim related it in 4/2099, no. 2743, in the chapter on remembrance, the story of the companions of the cave.