The Prophet (peace and blessings be upon him) said:
"Asking permission is (only) three times. Then if you are given permission to enter, (well and good); otherwise, go back."
Hadith Referenceصحیح الجامع الصغیر / حرف الألف / 2771
Hadith Gradingالألبانی:صحيح
Hadith Takhrij[م ت] عن أبي موسى وأبي سعيد. خ - استئذان، مختصر مسلم ١٤٢١.