Anas ibn Malik reported: The Prophet, peace and blessings be upon him, would say upon leaving the washroom, “All praise is due to Allah, who has removed harm from me and granted me wellness.”
Source: Sunan Ibn Mājah 301
Grade: Sahih (authentic) according to Al-Suyuti
عَنْ أَنَسِ بْنِ مَالِكٍ قَالَ كَانَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذَا خَرَجَ مِنْ الْخَلَاءِ قَالَ الْحَمْدُ لِلَّهِ الَّذِي أَذْهَبَ عَنِّي الْأَذَى وَعَافَانِي
301 سنن ابن ماجه كتاب الطهارة وسننها باب ما يقول إذا خرج من الخلاء
6631 المحدث السيوطي خلاصة حكم المحدث صحيح في الجامع الصغير