Following up with good deeds after committing sins may even dissolve the sin of having external physical intimacy someone other than your spouse
A man came to the Prophet ﷺ and said, "O Prophet of Allah, I took a woman in the garden, and I have done everything with her except that I did not have sexual intercourse with her: I kissed her, fondled her, but did nothing else. So, do with me as you wish." The Messenger of Allah ﷺ did not say anything to him. The man left, and ʿUmar said, "Allah has concealed his fault; if only he had concealed it himself."
The Messenger of Allah ﷺ then followed the man's gaze and said, "Bring him back to me." They brought him back, and the Messenger of Allah ﷺ recited to him, "And establish prayer at the two ends of the day and at the approach of the night. Indeed, good deeds do away with misdeeds. That is a reminder for those who remember. (Hūd 11:114)" Muʿādh b. Jabal asked, "Is this for him alone, O Prophet of Allah, or for all people?" He replied, "No, this is for all people."
جَاءَ رَجُلٌ إِلَى النَّبِيِّ ﷺ فَقَالَ: يَا نَبِيَّ اللهِ إِنِّي أَخَذْتُ امْرَأَةً فِي الْبُسْتَانِ، فَفَعَلْتُ بِهَا كُلَّ شَيْءٍ غَيْرَ أَنِّي لَمْ أُجَامِعْهَا، قَبَّلْتُهَا، وَلَزِمْتُهَا، وَلَمْ أَفْعَلْ غَيْرَ ذَلِكَ، فَافْعَلْ بِي مَا شِئْتَ۔ فَلَمْ يَقُلْ لَهُ رَسُولُ اللهِ ﷺ شَيْئًا۔ فَذَهَبَ الرَّجُلُ فَقَالَ عُمَرُ لَقَدْ سَتَرَ اللهُ عَلَيْهِ لَوْ سَتَرَ عَلَى نَفْسِهِ۔
قَالَ: فَأَتْبَعَهُ رَسُولُ اللهِ ﷺ بَصَرَهُ فَقَالَ: «رُدُّوهُ عَلَيَّ.» فَرَدُّوهُ عَلَيْهِ فَقَرَأَ عَلَيْهِ {وَأَقِمِ الصَّلَاةَ طَرَفَيِ النَّهَارِ وَزُلَفًا مِنَ اللَّيْلِ إِنَّ الْحَسَنَاتِ يُذْهِبْنَ السَّيِّئَاتِ} [هود 114] إِلَى {الذَّاكِرِينَ}، فَقَالَ مُعَاذُ بْنُ جَبَلٍ: أَلَهُ وَحْدَهُ أَمْ لِلنَّاسِ كَافَّةً يَا نَبِيَّ اللهِ؟ فَقَالَ: «بَلْ لِلنَّاسِ كَافَّةً۔»