The Messenger of Allah ﷺ said, "No Muslim who loses three children will be touched by the Fire, except for the brief moment that fulfills the oath."
أخبرنا قتيبة بن سعيد عن مالك عن ابن شهاب عن سعيد
أن رسول الله ﷺ قال لا يموت لأحد من المسلمين ثلاثة من الولد فتمسه النار إلا تحلة القسم
Related by Bukhari, [Book of] Oaths and Vows, chapter "Allah's statement, "They swear by Allah with their most solemn oaths" [Nahl 16:38]," hadith no. 6656, and by Muslim, [Book of] Righteousness and Maintaining Ties of Kinship, chapter on the virtue of one whose child dies and he seeks reward for it, from the hadith of Malik through the same chain. It is also found in the Muwatta (Yahya's narration), 1/235, and in Kubra, hadith no. 2003. Hadith no. 2632.