I entered the mosque just as the sun was setting, and the Prophet ﷺ was sitting there. He said, "Abu Dharr, do you know where this sun goes?"I said, "Allah and His Messenger know best."He said, "It goes to seek permission to prostrate, and permission is granted to it. But it is as though it will be told, 'Rise from where you came,' so it will rise from its place of setting."Then he recited, "And that is its resting place." He said, and that is the recitation of Abdullah bin Masud.
حدثنا هناد حدثنا أبو معاوية عن الأعمش عن إبراهيم التيمي عن أبيه
دخلت المسجد حين غابت الشمس والنبي ﷺ جالس فقال يا أبا ذر أتدري أين تذهب هذه قال قلت الله ورسوله أعلم قال فإنها تذهب تستأذن في السجود فيؤذن لها وكأنها قد قيل لها اطلعي من حيث جئت فتطلع من مغربها قال ثم قرأ وذلك مستقر لها قال وذلك قراءة عبد الله بن مسعود
Agreed upon. Bukhari related it in the Book of Tawhid, chapter "His Throne was upon the water..." etc., no. 7424, and Muslim, no. 159, from the hadith of Abu Muawiya Dareer, with this wording.On this topic there are also narrations from Safwan bin Assal [Ibn Majah, no. 4070], Huzaifa bin Usayd [mentioned previously at 2183], Anas [Ibn Majah, no. 4056], and Abu Musa [Muslim, no. 2759].