The Prophet of Allah ﷺ said, "What is wrong with people who raise their eyes toward the sky during their prayer?" He spoke about this with severity until he said, "They must stop doing so, or their sight will be snatched away."
حدثنا ابن أبي عدي عن سعيد وابن جعفر حدثنا سعيد والخفاف عن سعيد عن قتادة
أن نبي الله ﷺ قال ما بال أقوام يرفعون أبصارهم إلى السماء في صلاتهم واشتد قوله في ذلك حتى قال لينتهن عن ذلك أو لتخطفن أبصارهم
Its isnad is sahih. Bukhari related it, 1/191, in "The Times of Prayer," "Raising the Eyes to the Sky," and Nasai, 3/7/1193, "Forgetfulness," "The Prohibition of Raising the Eyes to the Sky," and Abu Dawud in "Prayer," "Looking During Prayer" [1/240/913], and Ibn Majah in "Establishing Prayer," "Humility in Prayer" [1/332/1044].