Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrates that the Messenger of Allah (peace and blessings be upon him) used to teach us this supplication just as he taught us a surah of the Qur'an: "O Allah, I seek refuge in You from the punishment of Hell, I seek refuge in You from the punishment of the grave, I seek refuge in You from the trial of the False Messiah (al-Dajjal), I seek refuge in You from the trials of life and death, and I seek refuge in You from the trial of the grave."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12107