Fiqh-us-Sunnah Volume 4, Funerals and Dhikr, Fiqh 4.127B.

Section : On Hearing Thunder.

Ibn ‘Umar reported that whenever the Prophet, peace be upon him, heard the sound of thunder or lightning he would say, “O Allah, do not destroy us with Your wrath nor let us perish with Your punishment, and save us before it comes to pass.” (Reported by Tirmizhi, by its chain of authorities is weak)