Sahih Muslim Book 25, Hadith Number 5357.

Chapter : Asking permission to enter a house.

Abu Sa’id reported that Abu Musa al-Ash’ari came to the door of ‘Umar and sought his permission (to get into his house). Umar said: That is once. He again sought permission for the second time and ‘Umar said: It is twice. He again sought permission for the third time and Umar said: It is thrice. He (Abu Musa) then went back. He (Hadrat ‘Umar) (sent someone) to pursue him so that he should be brought back. Thereupon he (Hadrat Umar) said: If this act (of yours is in accordance with the command of Allah’s Messenger (may peace be upon him) you have preserved in your mind, then it is all right, otherwise (I shall give you such a severe punishment) that it will serve as an example to others. Abu Sa’id said: Then he (Abu Musa) came to us and said: Do you remember Allah’s Messenger (may peace be upon him) having said this: “Permission is for three times”? They (Companions sitting in that company) began to laugh, whereupon he (Abu Musa) said: There comes to you your Muslim brother who had been perturbed and you laugh. Abu Sa’id said: (Well), you go forth. I shall be your participant in this trouble of yours. So he came to him (Hadrat Umar) and said: Here is Abu Sa’id (to support my statement).