It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever among you is able to be like the man of the measure of rice, let him be like him." The Companions said: O Messenger of Allah! Who is the man of the measure of rice? He (peace and blessings be upon him) said: "Three men went out, and clouds covered the sky above them, so they entered a cave. Then a rock came and settled over the entrance. They tried to move it but could not. So they said to one another: You have fallen into great difficulty, so let each of you supplicate by means of his best deed; perhaps Allah will rescue us from this." (Then the narrator related the well-known hadith of the cave in full.)
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13131