كتاب صلاة المسافرين وقصرها
6  
The Book of Prayer - Travellers
(31)
Chapter: The command to one who becomes sleepy while praying, or who starts to falter in his recitation of the Qur’an or statements of remembrance, to lie down or sit down until that goes away
(31)
باب أَمْرِ مَنْ نَعَسَ فِي صَلاَتِهِ أَوِ اسْتَعْجَمَ عَلَيْهِ الْقُرْآنُ أَوِ الذِّكْرُ بِأَنْ يَرْقُدَ أَوْ يَقْعُدَ حَتَّى يَذْهَبَ عَنْهُ ذَلِكَ
Sahih Muslim 786

'A'isha reported Allah's Apostle (ﷺ) as saying:

When anyone amongst you dozes in prayer, he should sleep, till sleep is gone, for when one of you prays while dozing he does not know whether he may be asking pardon or vilifying himself.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ نُمَيْرٍ، ح وَحَدَّثَنَا ابْنُ نُمَيْرٍ، حَدَّثَنَا أَبِي ح، وَحَدَّثَنَا أَبُو كُرَيْبٍ، حَدَّثَنَا أَبُو أُسَامَةَ، جَمِيعًا عَنْ هِشَامِ بْنِ عُرْوَةَ، ح وَحَدَّثَنَا قُتَيْبَةُ، بْنُ سَعِيدٍ - وَاللَّفْظُ لَهُ - عَنْ مَالِكِ بْنِ أَنَسٍ، عَنْ هِشَامِ بْنِ عُرْوَةَ، عَنْ أَبِيهِ، عَنْ عَائِشَةَ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏ "‏ إِذَا نَعَسَ أَحَدُكُمْ فِي الصَّلاَةِ فَلْيَرْقُدْ حَتَّى يَذْهَبَ عَنْهُ النَّوْمُ فَإِنَّ أَحَدَكُمْ إِذَا صَلَّى وَهُوَ نَاعِسٌ لَعَلَّهُ يَذْهَبُ يَسْتَغْفِرُ فَيَسُبُّ نَفْسَهُ ‏"‏ ‏.‏
Reference : Sahih Muslim 786
In-book reference : Book 6, Hadith 263
USC-MSA web (English) reference : Book 4, Hadith 1718
  (deprecated numbering scheme)