I would like to share with you some excerpts from the chapter "Seeking forgiveness" from Riyadh as Saliheen"
Allah, the Exalted, says:
"And ask forgiveness for your sin...'' (47:19)
"And seek the forgiveness of Allah. Certainly, Allah is Ever Oft-Forgiving, Most Merciful.'' (4:106)
"And declare the freedom of your Rubb from imperfection beginning with His praise, and ask His forgiveness. Verily, He is the One Who accepts the repentance and Who forgives.'' (110:3)
"For Al-Muttaqun (the pious) there are Gardens (Jannah) with their Rubb, underneath which rivers flow. Therein (is their) eternal (home) and Azwajun Mutahharatun (purified mates or wives). And Allah will be pleased with them. And Allah is All-Seer of the (His) slaves. Those who say: `Our Rubb! We have indeed believed, so forgive us our sins and save us from the punishment of the Fire. (They are) those who are patient, those who are true (in Faith, words, and deeds), and obedient with sincere devotion in worship to Allah. Those who spend (give the Zakat and alms in the way of Allah) and those who pray and beg Allah's Pardon in the last hours of the night.'' (3:15-17)
"And whoever does evil or wrongs himself but afterwards seeks Allah's forgiveness, he will find Allah Oft-Forgiving, Most Merciful.'' (4:110)
"And Allah would not punish them while you (Muhammad (PBUH)) are amongst them, nor will He punish them while they seek (Allah's) forgiveness.'' (8:33)
"And those who, when they have committed Fahishah (illegal sexual intercourse) or wronged themselves with evil, remember Allah and ask forgiveness for their sins; - and none can forgive sins but Allah - and do not persist in what (wrong) they have done, while they know.'' (3:135)
The Qur'anic Ayat on the subject are many and well-known.
1869. Al-Agharr Al-Muzani (May Allah be pleased with him) said: The Messenger of Allah (PBUH) said, "Sometimes I perceive a veil over my heart, and I supplicate Allah for forgiveness a hundred times in a day.''
Commentary: Ghain and Ghaim are two synonyms. They signify the spreading of the clouds. It refers in this Hadith to the fact that the Prophet (PBUH) was reciting the Names of Allah and remembering Him all the time. But sometimes due to being too busy in the affairs of the public or due to human needs, there was a pause in this eternal remembrance. Although such a pause was only momentary, this momentary pause was very much disliked by him; and considering it a slackness on his part, he prayed for forgiveness from Allah. In this there is an important lesson for us.
In spite of our many sins and negligence on our part, we do not turn to Allah and seek forgiveness; while, although our Prophet (PBUH) had all his past and future sins forgiven by Allah, he sought forgiveness very often.
1870. Abu Hurairah (May Allah be pleased with him) said: I heard the Messenger of Allah (PBUH) saying, "I swear by Allah that I seek Allah's Pardon and turn to Him in repentance more than seventy times a day.''
1871. Abu Hurairah (May Allah be pleased with him) said: The Messenger of Allah (PBUH) said, "By the One in Whose Hand my soul is! If you do not commit sins, Allah would replace you with a people who would commit sins and seek forgiveness from Allah; and Allah will certainly forgive them.''
Commentary: This Hadith does not mean that Allah likes disobedience. But by this way of description, the aim is to emphasize the importance of seeking forgiveness from Allah. We know that every man commits sins. But Allah likes those people who, after committing a sin, do not stick to it, but right away seek forgiveness for their sins from Allah. They weep and express sorrow before Allah. By seeking forgiveness, a relationship with Allah is established between man and his Creator. So seeking forgiveness is a very good act.
1872. Ibn `Umar (May Allah be pleased with them) said: We counted Messenger's saying a hundred times during one single sitting: Rabb-ighfir li, wa tubb `alayya, innaka Antat-Tawwabur-Rahim. (My Rubb! Forgive me and pardon me. Indeed, You are the Oft-Returning with compassion and Ever Merciful.''
[Abu Dawud and At-Tirmidhi].
Commentary: This Hadith tells us about the etiquette of praying to Allah. We should use the Names of Allah befitting our prayers, i.e., the Names of Allah signifying those Attributes of Allah which have a special concern with the subject of our particular prayer, i.e., while seeking forgiveness, His Names concerning His Attributes of forgiveness and kindness should be used. On the other hand, while praying for worldly matters, we should mention His Qualities of charity and bestowing gifts etc.
1873. Ibn `Abbas (May Allah be pleased with them) said: The Messenger of Allah (PBUH) said, "If anyone constantly seeks pardon (from Allah), Allah will appoint for him a way out of every distress and a relief from every anxiety, and will provide sustenance for him from where he expects not.''
Commentary: The chain of this narration is weak. Refer to `The Book of Weak Narrations' by Al-Albani, Vol. I, page 142, No.705.
1874. Ibn Mas`ud (May Allah be pleased with him) said: The Messenger of Allah (PBUH) said, "He who says: `Astaghfir ullah-alladhi la ilaha illa Huwal-Haiyul-Qayyumu, wa atubu ilaihi (I seek the forgiveness of Allah, there is no true god except Allah, the Ever-Living, the Self-Subsisting, and I turn to Him in repentance),' his sins will be forgiven even if he should have run away from the battlefield (while he was engaged in fighting for the Cause of Allah).''
[Abu Dawud, At-Tirmidhi and Al-Hakim (on conditions of Al-Bukhari and Muslim for accepting Hadith)].
Commentary: When we say that this narration fulfills the conditions of Al-Bukhari and Muslim; it means that its narrators are the narrators of Al-Bukhari and Muslim. Secondly, in this selection those conditions have also been kept in view, which are the landmark of Al-Bukhari and Muslim.
1875. Shaddad bin Aus (May Allah be pleased with him) said: The Prophet (PBUH) said, "The best supplication for seeking forgiveness (Syed-ul-Istighfar) is to say: `Allahumma Anta Rabbi, la ilaha illa Anta, khalaqtani wa ana `abduka, wa ana `ala `ahdika wa wa`dika mastata`tu, a`udhu bika min sharri ma sana`tu, abu'u laka bini`matika `alayya, wa abu'u bidhanbi faghfir li, fa innahu la yaghfirudh-dhunuba illa Anta. (O Allah! You are my Rubb. There is no true god except You. You have created me, and I am Your slave, and I hold to Your Covenant as far as I can. I seek refuge in You from the evil of what I have done. I acknowledge the favours that You have bestowed upon me, and I confess my sins. Pardon me, for none but You has the power to pardon).' He who supplicates in these terms during the day with firm belief in it and dies on the same day (before the evening), he will be one of the dwellers of Jannah; and if anyone supplicates in these terms during the night with firm belief in it and dies before the morning, he will be one of the dwellers of Jannah.''
1876. Thauban (May Allah be pleased with him) reported: Whenever the Messenger of Allah (PBUH) finished his Salat (prayer), he would beg forgiveness three times [by saying, `Astaghfirullah' (3 times)] and then he would say: "Allahumma Antas-Salamu, wa minkas-Salamu, tabarakta ya Dhal-Jalali wal-Ikram. (O Allah! You are the Bestower of security and security comes from You; Blessed are You. O Possessor of glory and honour).'' Imam Al-Auza`i (one of the subnarrators) of this Hadith was asked: "How forgiveness should be sought?'' He replied: "I say: Astaghfirullah, Astaghfirullah (I seek forgiveness from Allah. I seek forgiveness from Allah).''
Commentary: This Du`a' was a Sunnah of the Prophet (PBUH), and it is highly recommended to recite it after Salat.
1877. `Aishah (May Allah be pleased with her) reported: Prior to his demise, the Messenger of Allah (PBUH) used to supplicate frequently: Subhan Allahi wa bihamdihi; Astaghfirullaha wa atubu ilaihi (Allah is free from imperfection, and I begin with praising Him. I beg forgiveness from Allah and I turn to Him in repentance.''
[Al-Bukhari and Muslim].
Commentary: In general, asking of forgiveness all the time is necessary and commendable. But during the old age and the last days of one's life it is particularly very essential. In this way, the Sunnah of the Prophet (PBUH) would also be followed.
1878. Anas (May Allah be pleased with him) said: I heard the Messenger of Allah (PBUH) saying, "Allah, the Exalted, has said: `O son of Adam! I shall go on forgiving you so long as you pray to Me and aspire for My forgiveness whatever may be your sins. O son of Adam! I do not care even if your sins should pile up to the sky and should you beg pardon of Me, I would forgive you. O son of Adam! If you come to Me with an earthful of sins and meet Me, not associating anything with Me in worship, I will certainly grant you as much pardon as will fill the earth.'''
Commentary: In this narration, there is good news for the sinners who do not stick to sins but rather repent and ask forgiveness from Allah. However numerous their sins may be, Allah will forgive all their sins. But there is a condition which they should fulfill, namely that they do not persist in what wrong they have done (3:135), as with persistence and repeatedly committing the sin, the act of seeking forgiveness becomes a futile act.