Hasan (may Allah have mercy on him) says that the Messenger of Allah (peace and blessings be upon him) said: "If a person's prayer does not prevent him from indecency and sin, (then understand that) it has only distanced him further from Allah."
Hadith Referenceمسند الشهاب / 508
Hadith Gradingمحدثین:إسناده مرسل
Hadith Takhrij«إسناده مرسل ، وأخرجه جامع البيان للطبري : 379» اسے حسن بصری تابعی نے رسول الله صلی اللہ علیہ وسلم سے روایت کیا ہے ۔