Following up with good deeds after committing sins may even dissolve the sin of having external physical intimacy someone other than your spouse
The man left but the Messenger of Allah ﷺ sent a man after him to call him back. He recited to him: "And perform Salāh, at the two ends of the day and in some hours of the night. Verily, the good deeds remove the evil deeds. That is a reminder for the mindful (Hūd 11:114)" until the end of the āyah. A man among the people said: "Is this specific for him?" He ﷺ said: 'No. Rather for all of the people."
فَانْطَلَقَ الرَّجُلُ فَأَتْبَعَهُ رَسُولُ اللَّهِ ﷺ رَجُلاً فَدَعَاهُ فَتَلاَ عَلَيْهِِمِ {أَقِمِ الصَّلاَةَ طَرَفَيِ النَّهَارِ وَزُلَفًا مِنَ اللَّيْلِ إِنَّ الْحَسَنَاتِ يُذْهِبْنَ السَّيِّئَاتِ ذَلِكَ ذِكْرَى لِلذَّاكِرِينَ} إِلَى آخِرِ الآيَةِ۔ فَقَالَ رَجُلٌ مِنَ الْقَوْمِ: هَذَا لَهُ خَاصَّةً؟ قَالَ: «لاَ، بَلْ لِلنَّاسِ كَافَّةً۔»