prayer prohibits immorality and wrongdoing
Purification of the heart is the ultimate religious objective of prayer
{ قَدْ أَفْلَحَ مَن تَزَكَّىٰ وَذَكَرَ اسْمَ رَبِّهِ فَصَلَّىٰ }
{ He has succeeded who purifies himself, who remembers the name of his Lord and prays }
The Quran 87:14–15{ إِنَّ الصَّلَاةَ تَنْهَىٰ عَنِ الْفَحْشَاءِ وَالْمُنكَرِ }
{ Verily, the prayer prohibits immorality and wrongdoing, and the remembrance of Allah is greater }
The Quran 29:45
Purification of the heart is the ultimate religious objective of prayer. A prayer will only be acceptable to Allah if it is done with sincerity, reverence, awareness, and repentance. Our prayers should cleanse the heart of every spiritual disease such as envy, malice, and arrogance.
Having performed prayer with this understanding and spiritual purpose, the natural result is that our prayers should prevent us from committing further sins and instill us with good character.
Purification of the heart is the ultimate religious objective of prayer.
The parable of the prayer is that of a running river in which we cleanse our hearts five times a day.
Prophet Muhammad (ﷺ), said:
مَثَلُ الصَّلَوَاتِ الْخَمْسِ كَمَثَلِ نَهْرٍ جَارٍ غَمْرٍ عَلَى بَابِ أَحَدِكُمْ يَغْتَسِلُ مِنْهُ كُلَّ يَوْمٍ خَمْسَ مَرَّاتٍ
The example of the five prayers is that of a river running at the door of one of you in which he cleanses himself five times a day.
Source: Sahih Muslim 668
When we are preparing for prayer, we should keep this image in mind so that our awareness is focused on the goal of attaining a pure heart. Related to this inward purification is the purification from sin, as prayer is among the greatest good deeds for which we expiate our sins.