Sahih al-Bukhari, Book 34, Hadith 162 (Bukhari 2134)

Narrated Ibn `Umar:

The Prophet (ﷺ) said, "While three persons were walking, rain began to fall and they had to enter a cave in a mountain. A big rock rolled over and blocked the mouth of the cave. They said to each other, 'Invoke Allah with the best deed you have performed (so Allah might remove the rock)'. One of them said, 'O Allah! My parents were old and I used to go out for grazing (my animals). On my return I would milk (the animals) and take the milk in a vessel to my parents to drink. After they had drunk from it, I would give it to my children, family and wife. One day I was delayed and on my return I found my parents sleeping, and I disliked to wake them up. The children were crying at my feet (because of hunger). That state of affairs continued till it was dawn. O Allah! If You regard that I did it for Your sake, then please remove this rock so that we may see the sky.' So, the rock was moved a bit. The second said, 'O Allah! You know that I was in love with a cousin of mine, like the deepest love a man may have for a woman, and she told me that I would not get my desire fulfilled unless I paid her one-hundred Dinars (gold pieces). So, I struggled for it till I gathered the desired amount, and when I sat in between her legs, she told me to be afraid of Allah, and asked me not to deflower her except rightfully (by marriage). So, I got up and left her. O Allah! If You regard that I did if for Your sake, kindly remove this rock.' So, two-thirds of the rock was removed. Then the third man said, 'O Allah! No doubt You know that once I employed a worker for one Faraq (three Sa's) of...