I pray, however I (still) perform some evil actions; so, what is your advice for me? And why does my prayer not prevent me from forbidden actions?
Shaykh Uthaymeen Replies:
My advice for you is that you repent to Allah (The Mighty and Majestic) and that you sincerely draw close to Allah. (Likewise) that you recall the greatness of the one you have disobeyed and recall His punishment (The Mighty and Majestic), for whoever opposes his command.
You should also read the statement of Allah,
نَبِّئۡ عِبَادِىٓ أَنِّىٓ أَنَا ٱلۡغَفُورُ ٱلرَّحِيمُ (٤٩) وَأَنَّ عَذَابِى هُوَ ٱلۡعَذَابُ ٱلۡأَلِيمُ (٥٠)
Declare (O Muhammad SAW) unto My slaves, that truly, I am the Oft-Forgiving, the Most-Merciful. (49) And that My Torment is indeed the most painful torment. (50)
So, seek Allah’s forgiveness and mercy and fear his punishment. As for your situation, i.e. that you pray and you prayer does not prevent you from evil actions, then perhaps your prayer has deficiencies, because the prayer which prevents from fahshaa (i.e. great sins) and munkar (everything Islam rejects & has prohibited) is the complete prayer, (meaning) the prayer which is (performed) in accordance to that which the Messenger of Allah came with; with presence of heart, performing the actions (of the prayer) as they were reported in the sunnah. It is not every prayer which prevents from fahshaa (i.e. great sins) and munkar (every thing Islam censures & has forbidden ), rather it is the established prayer (in the sunnah) which the people perform in the manner which is befitting.
Allah The Most High said:
﴿اتْلُ مَا أُوحِيَ إِلَيْكَ مِنَ الْكِتَابِ وَأَقِمِ الصَّلاةَ إِنَّ الصَّلاةَ تَنْهَى عَنِ الْفَحْشَاءِ وَالْمُنْكَرِ﴾ [العنكبوت:45]
Recite (O Muhammad (sallallaahu alaihi wa salam) what has been revealed to you of the Book (the Qur’ân), and perform As-Salât (Iqamât¬as¬Salât). Verily, As-Salât (the prayer) prevents from Al-Fahshâ’ (i.e. great sins of every kind, unlawful sexual intercourse) and Al-Munkar (i.e. disbelief, polytheism, and every kind of evil wicked deed).
Meaning, the prayer which is performed in the correct manner (according to the sunnah of the Messenger of Allah), prevents these evils.
(1) The questioner is alluding to this aayah in the Quran: Al-Ankaboot: 45
Source: Why Does My Prayer not Prevent me from Evil Actions – Shaykh Uthaymeen