Narrated Abu Musa: One night a house in Medina was burnt with its occupants. The Prophet spoke about them, saying, "This fire is indeed your enemy, so whenever you go to bed, put it out to protect yourselves."
Related hadith on this topic
Explanation & Benefits
Shaykh Abdul Sattar al-Hammad
Hadith Commentary:
(1)
In this hadith, the wisdom behind extinguishing the fire before sleeping is explained: there is a risk of burning from it. This applies to any fire, whether it is a lamp or a stove. In addition, the same ruling applies to gas heaters and electric bulbs.
(2)
Fire has been described as an enemy because there is always a risk of harm to life and property from it, just as there is danger from an enemy, even though it also has countless benefits.
(Fath al-Bari: 11/103)
Source: Hidayat al-Qari: Commentary on Sahih Bukhari, Urdu, Page: 6294