If we consider the functioning of the heart with worldly perspective it pumps the blood and supplies into the body. But when you think of yourself not just as human being and subtracting the worldly affairs from your life, there is something more that your heart can do more than just pumping blood into your body. Whatever we like or dislike depends on our choices and whatever choices we make depends on what our heart and our mind accept. Similarly, when you subtract your worldly affairs and desires you find the true meaning of your existence and your heart initiates to turn to the one personality that created you, you start obeying his law and that personality is nonetheless Allah SWT.
Allah SWT says in the Quran;
A day when there will be no benefit in wealth or children, but only in he who comes to Allah with a pure heart [Qur’an: Chapter 26, Verses 88-89]
When you tend to obey the laws of Allah SWT and try to make sure that you just do not skid from the path that has been prescribed by Allah. When you heart starts liking the acts done by you while following the right path you will feel extremely relaxed and satisfied. No matter what ever your problems are happening in your life you will find comfort in every inch of your life.
Allah SWT says in the Quran
“Those who have believed and whose hearts are assured by the remembrance of Allah. Unquestionably, by the remembrance of Allah hearts are assured [Qur’an: Chapter 13, Verse 28]”
We all know that this life is not permanent instead it’s a short transit where we are sitting in an examination. When you start thinking of your eternal life i.e. life after death, you will automatically find that someone is watching every action of yours, it is being recorded, and you will be answerable for it one day. When this feeling will be hatched in your heart you will automatically find an escape from your wrong deeds but more importantly you will also try to practice the teachings of Islam and you will try to practice good deeds as much as possible to rectify the errors and mistakes that you made in your life previously.
Allah SWT says in the Quran
And when My servants ask you, [O Muhammad], concerning Me – indeed I am near. I respond to the invocation of the supplicant when he calls upon Me. [Qur’an: Chapter 2, Verse 186]
When you go to a doctor, he examines you and gives you a prescription. Similarly, when you feel sinful and your heart feels a burden you move your gaze down and bend towards Allah. You ultimately seek forgiveness and find eternal peace in asking for forgiveness. You try to conversate with Allah through prayers, supplication, recitation of Quran. You try to find as many as possible ways to make sure that no matter what happens you must seek eternal peace for your heart.
Shahr bin Hawshab R.A narrated that I said to Umm Salamah R.A: “O Mother of the Believers! What was the supplication that the Prophet Mohammad ﷺ of Allah SWT said most frequently when he was with you?”
She said, “The supplication he said most frequently was: ‘O Changer of the hearts, make my heart firm upon Your religion and I asked him why did he supplicate it so frequently.”
“Prophet ﷺ said, ‘O Umm Salamah! Verily, there is no human being except that his heart is between Two Fingers of the Fingers of the Almighty, so whomsoever He wills He makes steadfast, and whomever He wills He causes to deviate.’ [Jami` at-Tirmidhi]