Allah Mighty and Majestic says in His Book, “And seek the forgiveness of Allah; Allah is ever Most Forgiving, Most Merciful.”
(وَاستَغفِرِ اللهَ إِنَّ اللهَ كَانَ غَفُوراً رَّحِيماً)
There are many places in the Quran where Allah assures us that if we sincerely repent, He will forgive us, even if we repeat our sins over and over again.
One can ask Allah’s forgiveness in many ways, but the Messenger of Allah ﷺ taught us the best of ways, which Imam al-Nawawi records for us in his Kitab al-adhkar. He says:
We relate in the Sunans of Abū Dāwūd, at-Tirmidhī and Ibn Mājah that Ibn ‘Umar reported: We used to count the Messenger of Allah saying one hundred times in one sitting: “Lord, forgive me and relent towards me. You are the Oft-Relenting, the Most Merciful.” At-Tirmidhī says that this is a ṣaḥīḥ hadith.
رَبِّ اغفِر لِي، وَتُب عَلَيَّ إِنَّكَ أَنتَ التَّوَّابُ الرَّحِيمُ.
“Rabbi-ghfir lī wa tub ‘alayya. Innaka Anta-t-Tawwābu-r-Raḥīm.”
We relate in the Sunans of Abū Dāwūd and at-Tirmidhī that ‘Abdullāh ibn ‘Abbās reported that the Messenger of Allah said: “Whoever says: I ask for the forgiveness of Allah, besides Whom there is no god, the Living, the Self-Subsisting, and I repent to Him will have his sins forgiven even if he has fled from the battlefield.” According to al-Ḥākim this hadith is ṣaḥīḥ, according to the criteria of both al-Bukhārī and Muslim.
أَستَغفِرُ اللهَ الَّذِي لَا إِلَهَ إِلَّا هُوَ، الحَيُّ القَيُومُ، وَأَتُوبُ إِلَيهِ.
“Astaghfiru-llāha-lladhī lā ilāha illā Huwa-l-Ḥayyu-l-Qayyūmu wa atūbu ilayh.”
There is adab, or decorum, of making repentance. The most important of them, scholars say, is that we should be sincere and resolve never to return to that sin again. There are many more hadiths that teach us du’as for forgiveness. These are also combined in the Hizbs, or litanies, of pious people such as Imam Abu al-Hasan al-Shadhili. If you would like to memorize these prayers, have a look at Kiflayn’s program for memorizing Hizb al-Kabir and the Wazifa.