Abu Hurairah reported,

The Prophet ﷺ reported, narrating from his Lord عز وجل, that He said:A servant committed a sin and said, "O Allah, forgive me my sin."Allah تبارك وتعالى said, "My servant has committed a sin and has come to know that he has a Lord who forgives sins and holds people accountable for them."Then he returned and sinned again, and said, "My Lord, forgive me my sin."Allah تبارك وتعالى said, "My servant has committed a sin and has come to know that he has a Lord who forgives sins and holds people accountable for them."Then he returned and sinned again, and said, "My Lord, forgive me my sin."Allah تبارك وتعالى said, "My servant has committed a sin and has come to know that he has a Lord who forgives sins and holds people accountable for them. Do as you wish, for I have forgiven you."Abdul-Ala, one of the narrators of the hadith, said, "I do not know whether He said on the third or the fourth occasion, 'Do as you wish.'"

Azami 11447

Sahih

عن أبي هريرة

عن النبي ﷺ، فيما يحكي عن ربه عز وجل، قال: أذنب عبد ذنبا، فقال: اللهم اغفر لي ذنبي، فقال تبارك وتعالى: أذنب عبدي ذنبا، فعلم أن له ربا يغفر الذنب، ويأخذ بالذنب، ثم عاد فأذنب، فقال: أي رب اغفر لي ذنبي، فقال تبارك وتعالى: عبدي أذنب ذنبا، فعلم أن له ربا يغفر الذنب، ويأخذ بالذنب، ثم عاد فأذنب فقال: أي رب اغفر لي ذنبي، فقال تبارك وتعالى: أذنب عبدي ذنبا، فعلم أن له ربا يغفر الذنب، ويأخذ بالذنب، اعمل ما شئت فقد غفرت لك قال عبد الأعلى (أحد رواة الحديث): لا أدري أقال في الثالثة أو الرابعة: اعمل ما شئت.

الأعظمي 11447صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Repentance and seeking forgiveness
Chapter
Comprehensive and general supplications
Section
Allah accepts the repentance of His servant if he is sincere, even if he repeats the sin
Numbering
Jami al-Kamil 11447 (2nd edition)
Azami 11447