The Prophet ﷺ said, "When one of you grows drowsy during prayer, let him sleep until he knows what he is reciting."
عن النبي ﷺ قال: إذا نعس أحدكم في الصلاة فلينم حتى يعلم ما يقرأ.
Bukhari narrated it in the Book of Wudu (213), from Abu Muamar, who said, Abdul-Warith narrated to us, Ayub narrated to us, from Abu Qilaba, from Anas, and he mentioned it.Nasai narrated it (443) through another route from Ayub, with this wording, "If any of you dozes off during his prayer, let him withdraw and sleep."