Ibn ‘Abbas said that the Prophet used to teach them this prayer just as he used to teach them a sura of the Qur’an, telling them te say, “O God, I seek refuge in Thee from the punishment in jahannam, I seek refuge in Thee from the punishment in the grave, I seek refuge in Thee from the trial of the antichrist, and I seek refuge in Thee from the trial of life and death.”
Muslim transmitted it.