It was the practice of the Prophet (peace and blessings be upon him):
"When he (peace and blessings be upon him) came out of the toilet, he would say: O Allah, I ask for Your forgiveness."
Hadith Referenceصحیح الجامع الصغیر / حرف الكاف / 4707
Hadith Gradingالألبانی:حسن
Hadith Takhrij[حم ٤ حب ك] عن عائشة. المشكاة ٣٥٩، صحيح أبي داود ٢٢، الإرواء ٥٢.