He came to the Prophet ﷺ and said, "While I was praying, I heard a speaker saying, 'O Allah, all praise belongs to You, all dominion belongs to You, in Your hand is all goodness, to You returns every matter, both its open and hidden aspects. You are worthy of being praised. Indeed, You are capable of all things. O Allah, forgive me for all my past sins, protect me throughout the rest of my life, and grant me pure deeds with which You will be pleased.'"The Prophet ﷺ replied, "That was an angel who came to teach you how to praise your Lord."
حدثنا عفان حدثنا همام حدثنا الحجاج بن فرافصة حدثني رجل
أنه أتى النبي ﷺ فقال بينما أنا أصلي إذ سمعت متكلما يقول اللهم لك الحمد كله ولك الملك كله بيدك الخير كله إليك يرجع الأمر كله علانيته وسره فأهل أن تحمد إنك على كل شيء قدير اللهم اغفر لي جميع ما مضى من ذنبي واعصمني فيما بقي من عمري وارزقني عملا زاكيا ترضى به عني فقال النبي ﷺ ذاك ملك أتاك يعلمك تحميد ربك
No references are available.
Its isnad is daif, due to the unknown identity of the narrator from Huzaifa. Haythami said the same, 10/96.