Some reliable people testified before me, and among them was Umar ibn al-Khattab, and most reliable in my eyes was Umar: The Prophet of Allah (ﷺ) said: There is no prayer after the dawn prayer until the sun rises; and there is no prayer after the 'Asr prayer until the sun sets.
Hadith Text & Reference
Some reliable people testified before me, and among them was Umar ibn al-Khattab, and most reliable in my eyes was Umar: The Prophet of Allah (ﷺ) said: There is no prayer after the dawn prayer until the sun rises; and there is no prayer after the 'Asr prayer until the sun sets.
Source: Sunan Abi Dawud 1276 | Book: Prayer (Kitab Al-Salat): Voluntary Prayers
Prohibition of Prayer Times
This hadith establishes three prohibited times for voluntary prayers: after Fajr until sunrise, after Asr until sunset, and during sunrise, sunset, and when the sun is at its zenith (as established in other narrations).
The wisdom behind these prohibitions includes avoiding resemblance to sun-worshippers who pray at sunrise/sunset, and because these are times when the gates of heaven are closed and deeds are not elevated.
Scholarly Exceptions
Scholars agree that prohibited prayers include all voluntary prayers without specific cause. However, exceptions include making up missed obligatory prayers, funeral prayers, prostration of recitation (sujud at-tilawah), and the two rak'ahs of Tawaf.
The prayer of greeting the mosque (tahiyyat al-masjid) is permitted by most scholars during prohibited times if one enters the mosque at these times.
Juridical Consensus
All four Sunni madhabs agree on the prohibition of voluntary prayers during these times based on multiple authentic narrations. The Hanafis include midday when the sun is at its zenith as another prohibited time.
The severity of this prohibition is emphasized by the fact that even if one begins a voluntary prayer shortly before these times, they should shorten it to avoid continuing into the prohibited period.