(5) باب قَبُولِ التَّوْبَةِ مِنَ الذُّنُوبِ وَإِنْ تَكَرَّرَتِ الذُّنُوبُ وَالتَّوْبَةُ
Abu Huraira reported from Allah's Messenger (ﷺ) that his Lord, the Exalted and Glorious, thus said. A servant committed a sin and he said:
O Allah, forgive me my sins, and Allah (the Exalted and Glorious) said: My servant commited a sin and then he came to realise that he has a Lord Who forgives the sins and takes to account (the sinner) for the sin. He then again committed a sin and said: My Lord, forgive me my sin, and Allah, the Exalted and High, said: My servant committed a sin and then came to realise that he has a Lord Who would forgive his sin or would take (him) to account for the sin. He again committed a sin and said: My Lord, forgive me for my sin, and Allah (the Exalted and High) said: My servant sas committed a sin and then came to realise that he has a Lord Who forgives the sins or takes (him) to account for sin. O servant, do what you like. I have granted you forgiveness. 'Abd al-A'la said: I do not know whether he said thrice or four times to do" what you desire".
Reference: Sahih Muslim 2758 a
In-book reference: Book 50, Hadith 33
USC-MSA web (English) reference(deprecated numbering scheme): Book 37, Hadith 6642