Jareer bin Abdullah reported,

We were with the Prophet ﷺ when he looked at the moon on the night it was full and said, "You will surely see your Lord just as you see this moon. You will have no difficulty, or no trouble, in seeing Him. So if you are able not to be overcome from praying before sunrise and before sunset, then do so." Then he recited, "So glorify the praise of your Lord before the rising of the sun and before its setting" [Ta-Ha 20:130].

Bukhari 573

Sahih

حدثنا مسدد قال حدثنا يحيى عن إسماعيل حدثنا قيس قال لي

جرير بن عبد الله

كنا عند النبي ﷺ إذ نظر إلى القمر ليلة البدر فقال أما إنكم سترون ربكم كما ترون هذا لا تضامون أو لا تضاهون في رؤيته فإن استطعتم أن لا تغلبوا على صلاة قبل طلوع الشمس وقبل غروبها فافعلوا ثم قال {فسبح بحمد ربك قبل طلوع الشمس وقبل غروبها}

البخاري 573صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Prayer times
Chapter
Virtue of Fajr prayer
Numbering
Darussalam 573
Bukhari 573