The Messenger of Allah ﷺ said, "Whoever catches one rak'ah of the Fajr prayer before the sun rises has caught Fajr, and whoever catches one rak'ah of the Asr prayer before the sun sets has caught Asr."
أن رسول الله ﷺ قال: من أدرك من الصبح ركعة قبل أن تطلع الشمس فقد أدرك الصبح، ومن أدرك ركعة من العصر قبل أن تغرب الشمس فقد أدرك العصر.
Malik narrated it in Waqut Salah (5), from Zayd bin Aslam, from Ata bin Yasar, Bishr bin Saeed, and Araj, all of them narrating from Abu Hurairah. Through Malik's route, Bukhari narrated it in Mawaqit (579), and Muslim in Masajid (608). Muslim also narrated it (608) through another route, from Ibn Tawus, from his father, from Ibn Abbas, from Abu Hurairah, with similar wording.Bukhari also narrated it (556) through another route, from Abu Naeem, who said, Shayban told us, from Yahya, from Abu Salama, from Abu Hurairah, with this wording, "If one of you catches a sajdah of the Asr prayer before the sun sets, let him complete his prayer, and if he catches a sajdah of the Fajr prayer before the sun rises, let him complete his prayer."