Sahih al-Bukhari, Volume 4, Book 54, Hadith 421 (USC-MSA) ⓘ
Narrated Abu Dhar: The Prophet asked me at sunset, "Do you know where the sun goes (at the time of sunset)?" I replied, "Allah and His Apostle know better." He said, "It goes (i.e. travels) till it prostrates Itself underneath the Throne and takes the permission to rise again, and it is permitted and then (a time will come when) it will be about to prostrate itself but its prostration will not be accepted, and it will ask permission to go on its course but it will not be permitted, but it will be ordered to return whence it has come and so it will rise in the west. And that is the interpretation of the Statement of Allah: "And the sun Runs its fixed course For a term (decreed). that is The Decree of (Allah) The Exalted in Might, The All- Knowing." (36.38)
حَدَّثَنَا مُحَمَّدُ بْنُ يُوسُفَ، حَدَّثَنَا سُفْيَانُ، عَنِ الأَعْمَشِ، عَنْ إِبْرَاهِيمَ التَّيْمِيِّ، عَنْ أَبِيهِ، عَنْ أَبِي ذَرٍّ ـ رضى الله عنه ـ قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم لأَبِي ذَرٍّ حِينَ غَرَبَتِ الشَّمْسُ " تَدْرِي أَيْنَ تَذْهَبُ ". قُلْتُ اللَّهُ وَرَسُولُهُ أَعْلَمُ. قَالَ " فَإِنَّهَا تَذْهَبُ حَتَّى تَسْجُدَ تَحْتَ الْعَرْشِ، فَتَسْتَأْذِنَ فَيُؤْذَنَ لَهَا، وَيُوشِكُ أَنْ تَسْجُدَ فَلاَ يُقْبَلَ مِنْهَا، وَتَسْتَأْذِنَ فَلاَ يُؤْذَنَ لَهَا، يُقَالُ لَهَا ارْجِعِي مِنْ حَيْثُ جِئْتِ. فَتَطْلُعُ مِنْ مَغْرِبِهَا، فَذَلِكَ قَوْلُهُ تَعَالَى {وَالشَّمْسُ تَجْرِي لِمُسْتَقَرٍّ لَهَا ذَلِكَ تَقْدِيرُ الْعَزِيزِ الْعَلِيمِ }".
also referenced under: Book 59, Hadith 10 (In-Book) & Hadith 3199 (DarusSalam)