When the Messenger of Allah ﷺ began the prayer, he would say the takbir, then he would say, "I have turned my face toward the One who originated the heavens and the earth, devoted purely to Him, and I am not among those who associate partners with Allah. Truly my prayer, my rites of worship, my living, and my dying are for Allah, Lord of all the worlds. He has no partner. With that I have been commanded, and I am among the Muslims. O Allah, You are the Sovereign. There is no god but You. I am Your servant. I have wronged myself and I confess my sin, so forgive me all my sins, for none forgives sins but You. Guide me to the best of character, for none guides to the best of it but You. Turn away from me its evil, for none turns away its evil from me but You. Here I am, at Your service, ready to obey. All good is in Your hands, and evil is not attributed to You. I exist by You and return to You. Blessed and exalted are You. I seek Your forgiveness and turn to You in repentance."
أخبرنا عمرو بن علي قال حدثنا عبد الرحمن بن مهدي قال حدثنا عبد العزيز بن أبي سلمة قال حدثني عمي الماجشون بن أبي سلمة عن عبد الرحمن الأعرج عن عبيد الله بن أبي رافع
أن رسول الله ﷺ كان إذا استفتح الصلاة كبر ثم قال وجهت وجهي للذي فطر السموات والأرض حنيفا وما أنا من المشركين إن صلاتي ونسكي ومحياي ومماتي لله رب العالمين لا شريك له وبذلك أمرت وأنا من المسلمين اللهم أنت الملك لا إله إلا أنت أنا عبدك ظلمت نفسي واعترفت بذنبي فاغفر لي ذنوبي جميعا لا يغفر الذنوب إلا أنت واهدني لأحسن الأخلاق لا يهدي لأحسنها إلا أنت واصرف عني سيئها لا يصرف عني سيئها إلا أنت لبيك وسعديك والخير كله في يديك والشر ليس إليك أنا بك وإليك تباركت وتعاليت أستغفرك وأتوب إليك
Reported by Muslim, Prayer of the Traveler, chapter on the night prayer and supplication of the Prophet, no. 202/771, from the hadith of Ibn Mahdi through the same chain, and it is in Kubra, no. 971.