Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:50:39

So be patient, ˹O Muhammad˺, over what they say and exalt ˹Allah˺ with praise of your Lord before the rising of the sun and before its setting,  

So endure ˹patiently˺, addressing the Prophet (s), what they, the Jews and others, say, in the way of ˹anthropomorphic˺ comparisons and denials, and glorify with praise of your Lord, perform prayers with praise ˹of Him˺, before the rising of the sun, in other words, ˹perform˺ the morning prayer, and before the sunset, that is to say, ˹perform˺ both the midday and the afternoon prayers;
القرآن:٥٠:٣٩

فَاصْبِرْ عَلَىٰ مَا يَقُولُونَ وَسَبِّحْ بِحَمْدِ رَبِّكَ قَبْلَ طُلُوعِ الشَّمْسِ وَقَبْلَ الْغُرُوبِ  

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

See similar narrations below:

Collected by Qurʾān
quran:20:130

So be patient over what they say and exalt ˹Allah˺ with praise of your Lord before the rising of the sun and before its setting; and during periods of the night ˹exalt Him˺ and at the ends of the day, that you may be satisfied.  

So be patient with what they say — this is abrogated by the ‘fighting’ verse ˹cf. Q. 2:190ff˺ — and make glorifications, pray, by praising your Lord (bi-hamdi rabbika is a circumstantial qualifier, in other words, ‘ensconced in such ˹praise˺’) before the rising of the sun, the morning prayer, and before its setting — the afternoon prayer — and in the watches of the night, ˹during˺ the hours thereof, and make glorifications, perform the sunset and the evening prayer, and at either side of the day (wa-atrāfa’l-nahāri, a supplement to the syntactical locus of the accusative clause wa-min ānā’i, ‘and in the watches’), in other words, perform the noon prayer, because the time for it begins at the point where the sun starts to go down, which is the ˹end˺ side of the first half ˹of the day˺ and the ˹start˺ side of the second half ˹of the day˺; that perhaps you may be pleased, with the reward that you will be given.
القرآن:٢٠:١٣٠

فَاصْبِرْ عَلَىٰ مَا يَقُولُونَ وَسَبِّحْ بِحَمْدِ رَبِّكَ قَبْلَ طُلُوعِ الشَّمْسِ وَقَبْلَ غُرُوبِهَا ۖ وَمِنْ آنَاءِ اللَّيْلِ فَسَبِّحْ وَأَطْرَافَ النَّهَارِ لَعَلَّكَ تَرْضَىٰ  

{فاصبر على ما يقولون} منسوخ بآية القتال {وسبّح} صلّ {بحمد ربك} حال: أي ملتبساً به {قبل طلوع الشمس} صلاة الصبح {وقبل غروبها} صلاة العصر {ومن آناء الليل} ساعاته {فسبح} صل المغرب والعشاء {وأطراف النهار} عطف على محل من آناء المنصوب: أي صل الظهر لأن وقتها يدخل بزوال الشمس، فهو طرف النصف الأول وطرف النصف الثاني {لعلك ترضى} بما تعطى من الثواب.