Sayyiduna Abu Hurayrah (may Allah be pleased with him) said: I heard the Prophet (peace and blessings be upon him) say: "When a servant commits a sin and says: 'Ay Rabbi ighfir li' (O my Lord, forgive me), Allah says: My servant knows that he has a Lord who forgives sins and who can also hold him to account. Then Allah forgives him. Then after some time he sins again, and sometimes he commits several more sins, and then says: 'Ay Rabbi ighfir li' (O Allah, I have committed another sin, so forgive me), and Allah says: My servant knows that Allah will forgive him and can also hold him to account; and Allah forgives him. Then he waits for a while, then commits a sin, then says: 'Ay Rabbi ighfir li' (O Allah, forgive me my sin), and Allah says: My servant knows that Allah will forgive him and can also hold him to account. Then Allah says: 'Ghafartu li-'abdi falya'mal ma sha'a' (I have forgiven My servant, so let him do whatever he wishes)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20764