كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(25)
Chapter: From what refuge is to be sought when in salat
(25)
باب مَا يُسْتَعَاذُ مِنْهُ فِي الصَّلاَةِ ‏
Sahih Muslim 590

Ibn 'Abbas reported that the Messenger of Allah (ﷺ) used to teach them this supplication (in the same spirit) with which he used to teach them a surah of the Qur'an. He would thus instruct us:

"Say, O Allah, we seek refuge with Thee from the torment of Hell. And I seek refuge with Thee from the torment of the grave, and I seek refuge with Thee from the trial of al-Masih ad-Dajjal, and I seek refuge with Thee from the trial of life and death." Muslim b. Hajjaj said: It has reached me that Tawus said to his son: Did you make this supplication in prayer? He said: No. (Upon this) he (Tawus) said: Repeat the prayer. Tawus has narrated this hadith through three or four (transmitters) with words to the same effect.
وَحَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، عَنْ مَالِكِ بْنِ أَنَسٍ، - فِيمَا قُرِئَ عَلَيْهِ - عَنْ أَبِي الزُّبَيْرِ، عَنْ طَاوُسٍ، عَنِ ابْنِ عَبَّاسٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم كَانَ يُعَلِّمُهُمْ هَذَا الدُّعَاءَ كَمَا يُعَلِّمُهُمُ السُّورَةَ مِنَ الْقُرْآنِ يَقُولُ ‏ "‏ قُولُوا اللَّهُمَّ إِنَّا نَعُوذُ بِكَ مِنْ عَذَابِ جَهَنَّمَ وَأَعُوذُ بِكَ مِنْ عَذَابِ الْقَبْرِ وَأَعُوذُ بِكَ مِنْ فِتْنَةِ الْمَسِيحِ الدَّجَّالِ وَأَعُوذُ بِكَ مِنْ فِتْنَةِ الْمَحْيَا وَالْمَمَاتِ ‏"‏ ‏.‏ قَالَ مُسْلِمُ بْنُ الْحَجَّاجِ بَلَغَنِي أَنَّ طَاوُسًا قَالَ لاِبْنِهِ أَدَعَوْتَ بِهَا فِي صَلاَتِكَ فَقَالَ لاَ ‏.‏ قَالَ أَعِدْ صَلاَتَكَ لأَنَّ طَاوُسًا رَوَاهُ عَنْ ثَلاَثَةٍ أَوْ أَرْبَعَةٍ أَوْ كَمَا قَالَ ‏.‏
Reference : Sahih Muslim 590
In-book reference : Book 5, Hadith 170
USC-MSA web (English) reference : Book 4, Hadith 1225
  (deprecated numbering scheme)