Best Good Deeds to Expiate Sins
Question

Allah, may He be Exalted, says (interpretation of the meaning): “Verily, the good deeds remove the evil deeds” [Hood 11:114]. What is the greatest act of worship that can erase evil deeds? Is it saying La ilaha illallah (there is no god but Allah)? Do the words of Allah (interpretation of the meaning), “And whosoever fears Allah and keeps his duty to Him, He will make a way for him to get out (from every difficulty)” [At-Talaq 65:2] apply to the sinner who gives up his sin, repents, and asks Allah for forgiveness?
Praise be to Allah.How to expiate sins in Islam
Allah, may He be Exalted, expiates sins by means of repentance , calamities, good deeds that erase sin, and other means.
Ibn Al-Qayim (may Allah have mercy on him) said:
The traces of sin may be erased by means of sincere repentance , heartfelt affirmation of the Oneness of Allah (Tawhid), good deeds that erase sin, calamities that expiate sin , the intercession of those who intercede among those who affirm the Oneness of Allah, and finally, if he is punished for whatever sins remain, he will be brought out of Hell by virtue of his Tawhid (affirmation of the Oneness of Allah). (End quote from Hidayat Al-Hayara, p. 130)
Good deeds that erase sin include Wudu’, the five daily prayers, and Hajj and `Umrah. The greatest of good deeds is Tawhid (affirmation of the Oneness of Allah), and the gravest of evil deeds is disbelief and ascribing partners to Allah.
La Ilaha Illallah: The Greatest Declaration of Faith
Saying La ilaha illallah  (there is no god but Allah) is the greatest of good deeds, and the most sublime of the branches of faith, as the Prophet (blessings and peace of Allah be upon him) said: “Faith has seventy-odd – or sixty-odd – branches, the best of which is saying La ilaha ill-Allah , and the least of which is removing something harmful from the road, and modesty is a branch of faith.” (Narrated by Al-Bukhari, 9 and Muslim, 35, from the Hadith of Abu Hurayrah)
Imam Muslim narrated in his Sahih (2687) that Abu Dharr (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Allah, may He Glorified and Exalted, said: Whoever does a good deed will have a ten fold reward and more, and whoever does a bad deed its recompense is one like it, or I will forgive him.”
It was narrated from Abu Sa`id Al-Khudri (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Musa (peace be upon him) said: ‘O Lord, teach me something by which I may remember You and call upon You.’ He said: ‘Say: La ilaha illallah (there is no god but Allah).’ He said: ‘O Lord, all Your slaves say that.’ He said: ‘Say: La ilaha illallah.’  He said: ‘There is no god but You, my Lord, but I wanted something that is only for me.’ He said: ‘O Moosa, if the seven heavens and all their inhabitants others except Me, and the seven earths, were (placed) in one pan (of the Balance) and La ilaha illallah was placed in the other pan, La ilaha illallah would outweigh them.” (Narrated by Ibn Hibban, 6218 and Al-Hakim, 1936) Al-Hakim classed it as authentic and Adh-Dhahabi agreed with him. Al-Hafidh said in Al-Fat-h (11/208): It was narrated by An-Nasa’i with a sound chain of narration)
This points to the virtue of these great words.
Ibn Rajab (may Allah have mercy on him) said:
If a person’s Tawhid (affirmation of the Oneness of Allah) and his sincerity towards Allah are perfect, and he fulfills all its conditions in his heart, on his lips (verbally) and in his physical actions, or in his heart and on his lips at the time of death, then forgiveness for all his previous sins becomes certain, and it will protect him from entering Hell altogether. When a person truly believes in Tawhid in his heart, and he excludes from that everything other than Allah in terms of love, veneration, glorification, awe, fear, hope and trust, in that case his sins will all be erased, even if they are like the foam of the sea, and they may be turned into good deeds. For this Tawhid is the greatest elixir; if an atom of it were to be placed on mountains of sins, it would turn them into good deeds. (End quote from Jami` Al-`Ulum wal-Hukam, 2/417)
Undoubtedly those who utter these great words will vary in status, depending on how deeply its various meanings take root in their hearts.
Ibn Al-Qayyim (may Allah have mercy on him) said:
The greater a person’s Tawhid (affirmation of the Oneness of Allah), the more complete will Allah’s forgiveness of him be. Whoever meets Him not associating anything with Him at all, He will forgive him all his sins, no matter what they were, and he will not be punished for them.
We do not say that none of the people of Tawhid will enter the Fire; rather many of them will enter it because of their sins and will receive punishment commensurate with their wrongdoing, then they will be brought out of it. There is no contradiction between the two matters for the one who properly understands what we have mentioned above.
Here we will explain further the greatness of this status, because it is essential that it be understood. It should be noted that the rays of La ilaha illallah scatter the fog and clouds of sin in accordance with the strength or weakness of those rays. So this phrase has light, and those who believe in it vary with regard to the strength or weakness of that light, which no one knows except Allah, may He be Exalted. … The greater the light of these words, the more they will dispel specious arguments and whims and desires, until the individual reaches a state where he does not encounter any specious argument, whim, desire or sin, but these rays will dispel it. This is the state of one who is actually sincere in his Tawhid and does not associate anything with Allah. (End quote from Madarij As-Salikin, 1/338)
How Taqwa Leads to Relief from Allah
The words of Allah (interpretation of the meaning), {And whosoever fears Allah and keeps his duty to Him, He will make a way for him to get out (from every difficulty). And He will provide him from (sources) he never could imagine} [At-Talaq 65:2] offer a great promise to the pious who fear Allah.
The one who fears Allah is the one who fulfills obligatory duties and avoids things that are forbidden. That includes the one who sins, then repents and turns to Allah, and the one who goes back to sin , then repents from it again, because piety or fearing Allah, may He be Exalted, means doing what is enjoined and refraining from what is forbidden. If a person repents sincerely, his bad deeds will be expiated and turned into good deeds, as Allah, may He be Exalted, says (interpretation of the meaning):
{And those who invoke not any other ilah (god) along with Allah, nor kill such person as Allah has forbidden, except for just cause, nor commit illegal sexual intercourse and whoever does this shall receive the punishment. The torment will be doubled to him on the Day of Resurrection, and he will abide therein in disgrace; Except those who repent and believe (in Islamic Monotheism), and do righteous deeds; for those, Allah will change their sins into good deeds, and Allah is Oft-Forgiving, Most Merciful.} [Al-Furqan 25:68-70]
It is not stipulated that the pious one who fears Allah should be infallible and free of bad deeds, otherwise most people would be deprived of this honour and virtue. For every son of Adam sins, and the best of those who sin are those who repent. The one who sins then repents is one of the pious for whom there is the hope of the promise mentioned in the verse quoted above. The grace of Allah is vast, and what matters is that each individual should focus on striving.
And Allah knows best.