The Book of the Prohibited actions
Riyad as-Salihin #1075
كتاب الأمور المنهي عنها
عن أنس بن مالك قَالَ: قَالَ رسولُ اللهِ: « مَا بَالُ أقْوامٍ يَرْفَعُونَ أبْصَارَهُمْ إِلَى السَّمَاءِ في صَلاَتِهِمْ »! فَاشْتَدَّ قَولُهُ في ذَلِكَ حَتَّى قَالَ: « لَيَنْتَهُنَّ عَنْ ذَلِكَ، أَوْ لَتُخطفَنَّ أَبْصَارُهُمْ »!. رواه البخاري
Anas bin Malik (May Allah be pleased with him) said:
The Messenger of Allah (ﷺ) said, “How is it that some people raise their eyes towards the sky during As-Salat (the prayer)?” He stressed (this point) and added, “People must refrain from raising their eyes towards heaven in Salat (prayer), or else their sights will certainly be snatched away.”.
عن أنس بن مالك قَالَ : قَالَ رسولُ اللهِ : « مَا بَالُ أقْوامٍ يَرْفَعُونَ أبْصَارَهُمْ إِلَى السَّمَاءِ في صَلاَتِهِمْ » ! فَاشْتَدَّ قَولُهُ في ذَلِكَ حَتَّى قَالَ : « لَيَنْتَهُنَّ عَنْ ذَلِكَ ، أَوْ لَتُخطفَنَّ أَبْصَارُهُمْ » ! . رواه البخاري
The Messenger of Allah (ﷺ) said, "How is it that some people raise their eyes towards the sky during As-Salat (the prayer)?" He stressed (this point) and added, "People must refrain from raising their eyes towards heaven in Salat (prayer), or else their sights will certainly be snatched away.".
— Riyad as-Salihin, Hadith 1075