The Messenger of Allah ﷺ frequently said in his supplication, "O Allah, Turner of hearts, keep my heart firm upon Your religion."She said, "I asked, 'Messenger of Allah, do hearts truly turn?'"He replied, "Yes. There is no human being whom Allah created from the children of Adam whose heart is not between two of the fingers of Allah. If Allah wills, He keeps it firm, and if He wills, He turns it astray. So we ask Allah our Lord not to turn our hearts astray after He has guided us, and we ask Him to grant us mercy from Himself. Indeed, He is the Bestower."She said, "I asked, 'Messenger of Allah, will you not teach me a supplication to make for myself?'"He answered, "Of course. Say, 'O Allah, Lord of the Prophet Muhammad, forgive me my sins, remove the rage from my heart, and protect me from the misleading trials for as long as You keep me alive.'"
كان رسول الله ﷺ يكثر في دعائه أن يقول: اللهم مقلب القلوب، ثبت قلبي على دينك. قالت: قلت: يا رسول الله، أو إن القلوب لتتقلب؟ قال: نعم، ما من خلق الله من بني آدم من بشر إلا أن قلبه بين أصبعين من أصابع الله، فإن شاء الله عز وجل أقامه، وإن شاء أزاغه، فنسأل الله ربنا أن لا يزيغ قلوبنا بعد إذ هدانا، ونسأله أن يهب لنا من لدنه رحمة، إنه هو الوهاب. قالت: قلت: يا رسول الله، ألا تعلمني دعوة أدعو بها لنفسي؟ قال: بلى، قولي: اللهم رب النبي محمد اغفر لي ذنبي، وأذهب غيظ قلبي، وأجرني من مضلات الفتن ما أحييتنا.
Ahmad narrated it (26576), and Tabarani in Kabir (23/338), and in Duaa (1258), both through chains from Abdul-Hameed, who said, "Shahr bin Hawshab narrated to me, and said, 'I heard Umm Salama recounting that the Messenger of Allah ﷺ would often say in his supplication,'" then he mentioned it.Ibn Khuzayma graded it sahih, narrating it in Kitab Tawheed (133) through another route from Shahr bin Hawshab, with the same wording, similarly.Tirmidhi narrated it (3522) from Ubayy bin Kaab, the companion of the silk, from Shahr, in similar but abridged form, and Tirmidhi said, "This is a hasan hadith."I say, it is as he said, for Shahr bin Hawshab is truthful so long as he does not contradict others and does not bring into the text something that would be objected to. This hadith has corroborating witnesses for its parts. And there are other hadiths with a similar meaning mentioned in Kitab Iman.