Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran: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.  

Recite what has been revealed to you of the Book, the Qur’ān, and maintain prayer; truly prayer prohibits lewd acts and indecency, ˹defined as such˺ according to the Law. In other words, that is its purpose provided that the person adheres to ˹observance of˺ it. And the remembrance of God is surely greater, than other acts of obedience, and God knows what you do, and He will requite you for them.
القرآن:٢٩:٤٥

اتْلُ مَا أُوحِيَ إِلَيْكَ مِنَ الْكِتَابِ وَأَقِمِ الصَّلَاةَ ۖ إِنَّ الصَّلَاةَ تَنْهَىٰ عَنِ الْفَحْشَاءِ وَالْمُنْكَرِ ۗ وَلَذِكْرُ اللَّهِ أَكْبَرُ ۗ وَاللَّهُ يَعْلَمُ مَا تَصْنَعُونَ  

{اتل ما أوحي إليك من الكتاب} القرآن {وأقم الصلاة إن الصلاة تنهى عن الفحشاء والمنكر} شرعا أي من شأنها ذلك ما دام المرء فيها {ولذكر الله أكبر} من غيره من الطاعات {والله يعلم ما تصنعون} فيجازيكم به.