The Messenger of Allah ﷺ used to remember Allah at all times.
حدثنا محمد بن العلاء حدثنا ابن أبي زائدة عن أبيه عن خالد بن سلمة يعني الفأفاء عن البهي عن عروة
كان رسول الله ﷺ يذكر الله عز وجل على كل أحيانه
Muslim narrated it in the Book of Menstruation, chapter "Remembrance of Allah during janaba and other states," hadith no. 373, on his authority. Tirmidhi also narrated it, hadith no. 3384, and Ibn Majah, hadith no. 302. Bukhari mentioned it with a suspended chain in his Sahih, through Ala, see Fath al-Bari 1/407 and 2/114. Zakariya bin Abu Zaida explicitly stated that he heard it directly, according to the version in Ahmad, 6/278.