The Messenger of Allah ﷺ said, "When one of you prays toward a barrier, let him stay close to it so that Satan does not cut off his prayer."
أخبرنا علي بن حجر وإسحق بن منصور قالا حدثنا سفيان عن صفوان بن سليم عن نافع بن جبير
قال رسول الله ﷺ إذا صلى أحدكم إلى سترة فليدن منها لا يقطع الشيطان عليه صلاته
[Its chain of transmission is sahih]Abu Dawud narrated it in the Book of Prayer, Chapter on Being Close to the Sutra, hadith no. 695, from the hadith of Sufyan bin Uyayna, transmitted through him, and he explicitly stated that he heard it directly, as recorded by Humaydi, hadith no. 402, and it is also in al-Kubra, hadith no. 824.Ibn Khuzayma graded the hadith sahih, hadith no. 803, as did Ibn Hibban, hadith no. 409, and Hakim, 1/251–252, stating it meets the criteria of the two Sheikhs (Bukhari and Muslim), and Dhahabi agreed with him.