First: Seek refuge in Allah, the Exalted, from the evil of his trial, and do so frequently, especially during the final tashahhud (testimony of faith) in prayer. The Messenger of Allah (peace and blessings be upon him) said:
“When one of you has finished the final tashahhud, let him seek refuge in Allah from four things, saying: ‘O Allah, I seek refuge in You from the punishment of Hell, from the punishment of the grave, from the trials of life and death, and from the evil of the trial of the Dajjāl, the false messiah.’” (1)
It is established in the two Sahīh collections and elsewhere, through reports from a number of Companions—including ʿĀ’ishah (may Allah be pleased with her)—that the Prophet (peace and blessings be upon him) used to seek refuge from his trial.
Indeed, he gave a general command to seek refuge from it, as in the hadith of Zayd ibn Thābit, who said:
While the Prophet (peace and blessings be upon him) was riding a mule of his in a garden belonging to Banū al-Najjār, with us accompanying him, it suddenly swerved and nearly threw him off. There were six, five, or four graves there. He asked, “Who knows those buried in these graves?”
A man replied, “I do.”
He asked, “When did these people die?”
The man replied, “They died as polytheists” (in another narration: “during the pre-Islamic era”).
He said, “Indeed, this community is put to the test in their graves. Were it not that you would stop burying one another, I would ask Allah to let you hear some of the punishment of the grave that I hear.” Then he turned to face us and said: