It is narrated from Hazrat Anas (may Allah be pleased with him) that the Holy Prophet (peace and blessings be upon him) said: In times past, three men were traveling when it began to rain. The three of them took shelter in a cave on a mountain. A rock fell from above and blocked the entrance of the cave. They said to one another, "The rock has fallen, the traces of our footsteps have disappeared, and no one knows of our presence here except Allah. Therefore, let each person present before Allah a deed of truthfulness that he has done, and pray to Allah."
One of them said, "O Allah! You know that I had parents, and I used to milk for them into their vessel and bring it to them. When I found them asleep, I would stand at their heads, disliking to disturb their sleep, until they woke up, whenever they woke up (and then I would give it to them). O Allah! If in Your knowledge this action of mine was done out of fear of You, then remove this calamity from us." The rock opened up about one third.
The second person said, "O Allah! You know that I hired a laborer for some work. He came to me asking for his wage while I was angry, so I scolded him, and he went away leaving his wage. I gathered it and grew it until all this wealth came from it. Then he came to me asking for his wage, and I handed all of it over to him, although had I wished, I would have given him only his original wage. O Allah! If in Your knowledge I did this only out of fear of You, then remove this calamity from us." By the blessing of his prayer, the rock opened up about two thirds.
The third person said, "O Allah! You know that I was attracted to a woman, and I fixed a payment for her. When I had power over her, I spared her and let her keep the payment. O Allah! If this action of mine was done only out of fear of You, then remove this calamity from us." So the rock moved away, and they came out and began to walk about.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 12454