Yes, in Islam, it is taught that regular prayer (Salah) helps a person stay away from sinful behavior. This concept is derived from various verses in the Quran and Hadith (sayings of Prophet Muhammad, peace be upon him). One key verse in the Quran that highlights this is:
Surah Al-Ankabut (29:45): "Recite, [O Muhammad], what has been revealed to you of the Book and establish prayer. Indeed, prayer prohibits immorality and wrongdoing, and the remembrance of Allah is greater. And Allah knows that which you do."
This verse emphasizes that the purpose of Salah is not only to worship Allah but also to remind believers of their moral duties, guiding them away from sinful actions and promoting righteousness in daily life. Regular prayer fosters mindfulness of Allah, which, in turn, discourages immoral behavior and encourages good conduct.