The time for the sunset prayer begins with the disappearance of the sun and lasts until the red twilight ends. ‘Abdullah ibn ‘Amr reported that the Prophet, upon whom be peace, said, “The time for the sunset prayer is when the sun has disappeared and the twilight has not gone.” (Related by Muslim.) Abu Musa related that a man asked the Prophet about the prayer times, and he mentioned the hadith which states that he ordered the sunset prayer when the sun had set and, on the next day, he prayed it when the red twilight was ending and he said, “The time (for the sunset prayer) is between these two times.”
An-Nawawi says in his commentary on Sahih Muslim, “It is the opinion of the research scholars of our companions (the Shaf’iyyah) that… it is allowed to delay it as long as it is twilight. It is allowed to begin the prayer at any time during that period. There is no sin in delaying it from its earliest time.” Concerning the earlier quoted hadith in which Gabriel led the prayers and prayed the sunset prayer at the same time on both days, it only shows that it is greatly preferred to perform the sunset prayer as early as possible. This point is made clear by some other hadith:
As-Sa’ib ibn Yazid related that the Messenger of Allah, upon whom be peace, said, “My nation will always be along the natural path as long as they pray the sunset prayer before the stars appear.” (Related by Ahmad and at-Tabarani).
In Ahmad’s Musnad it is related from Abu Ayyub al-Ansari that the Prophet said, “Pray the sunset prayer when the fasting person breaks his fast and when the stars are about to appear.”
In Sahih Muslim it is related from Rafa’ ibn Khadeej that “We prayed the sunset prayer with the Messenger of Allah, and one of us would leave (afterwards) and would still be able to see where he shot his arrow, (because there was still so much light left in the sky).”
In Sahih Muslim it is recorded from Salamah ibn al-Aku’ that the Messenger of Allah, upon whom be peace, would pray the sunset prayer when the sun had set and disappeared (behind the horizon).