A man from among the companions of the Prophet ﷺ reported that he heard the Messenger of Allah ﷺ say, "When any of you is in prayer, let him not raise his gaze toward the sky, lest his sight be snatched away."
أخبرنا سويد بن نصر قال أنبأنا عبد الله عن يونس عن ابن شهاب
أن رجلا من أصحاب النبي ﷺ حدثه أنه سمع رسول الله ﷺ يقول إذا كان أحدكم في الصلاة فلا يرفع بصره إلى السماء أن يلتمع بصره
[Its isnad is sahih] Ahmad reported it in his Musnad, 3/441 and 5/295, from the hadith of Abdullah bin Mubarak, from Yunus bin Yazid Ayli, with the same wording. It is also found in al-Kubra, no. 1117.Ibn Shihab Zuhri explicitly stated that he heard it directly, and his teacher was Ubaydullah bin Abdullah bin Uqbah bin Masud.