Praise be to Allah.
Fire is one of the major calamities from which the Prophet (peace and blessings of Allaah be upon him) used to seek refuge with Allaah and he would ask Allaah to protect him from it and from other calamities.
It was narrated that Abu’l-Yusr (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) used to say: “Allaahumma inni a’oodhu bika min al-taraddi wa’l-hadmi wa’l-gharaqi wa’l-hareeq, wa a’oodhu bika an yatakhabbatani al-shaytaan ‘inda al-mawt, wa a’oodhu bika an amoota fi sabeelika mudbiran, wa a’oodhu bika an amoot ladeeghan (O Allaah, I seek refuge with You from falling from a high place, being crushed (beneath a falling building etc), drowning and burning, and I seek refuge with You from being overpowered by the Shaytaan at the time of death, and I seek refuge with You from being killed (in jihad) for Your sake when fleeing from battle, and I seek refuge with You from dying from a scorpion sting or snake bite).” Narrated by al-Nasaa’i (5531) and by al-Haakim in al-Mustadrak (1/713). He said: Its isnaad is saheeh although they (al-Bukhaari and Muslim) did not narrate it. Al-Haafiz Ibn Hajar said in Badhal al-Ma’oon (199): it is proven. It was classed as saheeh by al-Albaani in Saheeh al-Nasaa’i.
I do not know of any specific saheeh du’aa’ in the Sunnah that the Muslim may recite so that Allaah might protect him against fire. Rather he should pray to Allaah to protect him from harm and disliked things, and ask Allaah to keep him safe and sound, and seek refuge from the things from which the Prophet (peace and blessings of Allaah be upon him) used to seek refuge, as mentioned in the hadeeth quoted above, for Allaah is the best of protectors and the most merciful of those who show mercy.
See the answer to question no. 22816.
There is a da’eef hadeeth about protection from fire and other calamities, and perhaps this is what the questioner is referring to.
It was narrated that Talq ibn Habeeb said: A man came to Abu’l-Darda’ (may Allaah be pleased with him) and said: O Abu’l-Darda’, your house has burned down. He said: It has not burned down. I know that Allaah would not do that because of some words that I heard from the Messenger of Allaah (peace and blessings of Allaah be upon him); whoever says them at the beginning of the day, no calamity will befall him until evening comes, and whoever says them at the end of the day, no calamity will befall him until morning comes: “O Allaah, You are my Lord, there is no god but You, in You have I put my trust and You are the Lord of the Mighty Throne. Whatever Allaah wills happens, and whatever He does not will does not happen. There is no power and no strength except with Allaah, the Most High, the Almighty. I know that Allaah has power over all things and that Allaah has encompassed all things with His knowledge. O Allaah, I seek refuge with You from the evil of my own self, and from the evil of every living creature whose forelock is in Your hand. My Lord is on a straight path.”
This was narrated by Ibn al-Sunni in his book ‘Aml al-Yawm wa’l-Laylah (25/hadeeth 27) and by al-Tabaraani in al-Du’aa’ (2/954).
Ibn al-Jawzi said in al-‘Ilal al-Mutanaahiyah (2/836, 837):
This hadeeth is not proven, and the problem with it is (the narrator) al-Aghlab ibn Tameem, of whom Yahya ibn Ma’een said: He is nothing. Al-Bukhaari said: His hadeeth is munkar. End quote.
This hadeeth was also narrated via another isnaad with similar wording. It was narrated by al-Haarith ibn Abi Usaamah in his Musnad (2/953). He said: Yazeed ibn Haroon told us: Mu’aadh Abu ‘Abd-Allaah told us: A man narrated it to me from al-Hasan.
This is a weak isnaad because the man who narrated it from al-Hasan is unknown.
The hadeeth was classed as da’eef (weak) by al-‘Iraaqi in Takhreej Ihya’ ‘Uloom al-Deen (1/316) and by Shaykh al-Albaani in Tahqeeq al-Kalim al-Tayyib (74).
If Allaah decrees that a fire should occur, then some scholars regard it as mustahabb to say takbeer whilst putting it out, and they say that saying takbeer at the time of a fire will help in extinguishing it and prevent its harm.
A hadeeth concerning that was narrated from ‘Abd-Allaah ibn ‘Amr ibn al-‘Aas, saying that the Prophet (peace and blessings of Allaah be upon him) said: “If you see a fire, then say takbeer, for takbeer will extinguish it.” Narrated by Ibn al-Sunni in ‘Aml al-Yawm wa’l-Laylah (295) and by al-Tabaraani in al-Du’aa’ (1/307). But it is a weak hadeeth. See al-Silsilah al-Da’eefah by al-Albaani (2603).
Ibn Taymiyah (may Allaah have mercy on him) said in al-Fataawa al-Kubra (5/188):
Hence the slogan of the prayers, the adhaan and the Eids is the takbeer, and it is mustahabb to say it in high places such as al-Safa and al-Marwah, when a person climbs up a hill or rides his mount and so on. With it fires are extinguished even if they are great, and at the time of the adhaan the shaytaan flees. End quote.
Ibn al-Qayyim (may Allaah have mercy on him) said in Zaad al-Ma’aad (4/194):
Because a fire is caused by the substance of the shaytaan from which he was created, and it causes some general destruction which befits the shaytaan and his substance and actions, the shaytaan helped with it and played some role in it, fire by its very nature seeks to dominate and destroy. These two matters – domination of the earth and destruction – are the way of the shaytaan to which he calls people, and by means of which he destroys the sons of Adam. Fire and the shaytaan both seek to dominate on earth and spread corruption and destruction, but the might of the Lord, may He be glorified and exalted, suppresses the shaytaan and his actions. Hence magnifying Allaah (by saying takbeer) has an effect in extinguishing fires, for nothing can resist the might of Allaah, may He be glorified and exalted. When the Muslim magnifies his Lord, his takbeer has the effect of suppressing the fire and the shaytaan who is made of its substance, so the fire is extinguished. We ourselves and others have tried this, and we have found it to be so. And Allaah knows best.
And Allaah knows best.