The only way to be saved from hell is through iman (faith) and righteous deeds. So the Muslims pray to their Lord with faith to save them from the Fire. Allah said:” Those who say, Our Lord! We have indeed believed. Forgive us, then, our sins and save us from the agony of the Fire.”
Many hadiths speak in details about this matter and describe the deeds that will protect one from the Fire, for example, love of Allah. The Prophet (saw) said:” By Allah, Allah will never throw one who loves Him and whom He loves into the Fire.”
Fasting is also a source of protection from the Fire, as reported from Jabir ibn Abdillah, the Prophet (saw) said:” Allah, the Exalted, says:’ Fasting is a shield with which one may protect oneself from the Fire.’” Al-Bayhaqi reports from Uthman ibn Abi al-Ash that the Prophet (saw) said:” Fasting is a shield from the punishment of Allah.”
If fasting is accomplished at the time of jihad against the enemy, then that is a great victory, as it is reported from Abu Sa’eed al-Khudri that the Prophet (saw) said:” Whoever fasts for one day when he is engaged in jihad for the sake of Allah, Allah will remove him ‘seventy years’ distance from the Fire.” (Bukhari and Muslim)
Other means of salvation from the Fire are fear of Allah, and jihad for His sake. Allah (swt) said:” But for him who fears the standing before his Lord, there will be two gardens in Paradise.” (Qur’an 55: 46). The Prophet (saw) said:
”No one who weeps out of fear of Allah will enter Hell until the milk goes back into the breast, and a man will never have both the dust from fighting in the way of Allah and the smoke of Hell.” Bukhari reports from Abu Abs that the Prophet (saw) said:” No two feet that get dusty for the sake of Allah will ever be touched by the Fire.”
We may also be shielded from the Fire by seeking protection with Allah from it. Allah said in the Qur’an:” Those who say:” Our Lord! Avert from us the wrath of Hell, for its wrath is indeed an affiliation grievous. Evil indeed is it as an abode and as a place to rest in.” (Qur’an 25: 65-66)
Ahmad, Ibn Majah, Ibn Hibban, and Al-Hakim report, with a saheeh isnaad from Anas, that the Messenger of Allah said:” No one asks Allah for Paradise three times, but Paradise will say: O Allah, admit him to Paradise.’ And no Muslim asks Allah for protection from Hell three times, but Hell will say: O Allah, save him from me.”