This excerpt is taken from Sheikh Abu Hamza Abdul Khaliq Siddiqi's book Sahi Fazail-e-Amaal.
In the Holy Quran, the firm in knowledge are taught to pray to Allah Almighty for steadfastness in faith:
﴿رَبَّنَا لَا تُزِغْ قُلُوبَنَا بَعْدَ إِذْ هَدَيْتَنَا وَهَبْ لَنَا مِن لَّدُنكَ رَحْمَةً ۚ إِنَّكَ أَنتَ الْوَهَّابُ﴾
"O our Lord! After You have guided us to the straight path, do not let our hearts deviate (from the right path) and bestow upon us mercy from Yourself. Indeed, You are the Bestower."
Reference: (3-Al Imran:8)
Umm al-Mu'minin Sayyida Umm Salamah (RA) narrates that the Prophet Muhammad (PBUH) often prayed:
يا مقلب القلوب ثبت قلبي على دينك
"O Turner of the hearts! Keep my heart firm upon Your religion."
Reference: Tafsir al-Quran al-Azim, Ibn Kathir (may Allah have mercy on him) in the explanation of this verse.