Rectification of the heart requires several things, and with Allah alone we seek protection.
1. Improving the Connection with Allah
Verily the hearts of men are in Allah’s Hands, as the Prophet (peace and blessings upon him) said in an authentic hadith:
“Indeed the hearts are between two of Allah’s Fingers. He turns the heart as He wills.” [Muslim].
The Believer improves his connection with Allah by strengthening his hope and reliance in Allah, tawakkul (putting trust) in Allah, besieging Allah with du’a and invoking His help. Allah will rectify his heart and purify his soul and helps the Believer to overcome the evil that is within himself.
2. Read and Learn about Things Related to the Heart
Learn about things related to the heart, the actions of the heart and the importance of rectifying it. Read on what the People of Knowledge have written concerning the heart and its sickness. Knowledge is Nur. When the Believer knows the state of his heart and its importance, then verily Allah will rectify the heart by His will. The Prophet (peace and blessings upon him) said:
“Verily knowledge is acquired through learning, and tolerance is acquired by the practice of tolerating”. [At-Tabrani, authenticated by Sheikh Al-Albani]
He (peace and blessings upon him) precedes knowledge before tolerance, for verily knowledge beautifies men his goodness.
3. Struggle Against Oneself
وَالَّذِينَ جَاهَدُوا فِينَا لَنَهْدِيَنَّهُمْ سُبُلَنَا ۚ وَإِنَّ اللَّـهَ لَمَعَ الْمُحْسِنِينَ
“And those who strive for Us – We will surely guide them to Our ways …” [Al-Ankabut: 69].
And the Prophet (peace and blessings upon him) said:
“The Mujahid is someone who struggles against his nafs for the sake of obeying Allah.” [Ahmad, Ibnu Hibban, At-Tabarani, and others, authenticated by Sheikh Al-Albani]
So struggle against yourself. Never be overwhelmed with hopelessness and disheartenment, or other sicknesses of the heart. The Believer who struggles against himself improves his eeman and elevates his rank.
4. Always Be in Good Company and Good Gatherings
For they are the people that none who sits with them shall be miserable.
وَاصْبِرْ نَفْسَكَ مَعَ الَّذِينَ يَدْعُونَ رَبَّهُم
“And keep yourself patient (by being) with those who call upon their Lord…” [Al-Kahf: 28].
So strive towards being with good company, people that possess excellence and nobleness, for accompanying them is a great bounty. The Prophet (peace and blessings upon him) said:
“Man follows his friend’s religion; you should be careful who you take for friends.” [Abu Dawud, At-Tirmidhi and others]
5. Always Be in The Remembrance of Akhirah
The heart is the place where Allah will look into and take into account on the Day of Judgement.
إِلَّا مَنْ أَتَى اللَّـهَ بِقَلْبٍ سَلِيمٍ
“But only one who comes to Allah with Qalbun Salim (sound heart)” [Ash-Shu’ara: 89]