Ibn al-Qayyim (may Allaah have mercy on him) said:
The principle of patience in refraining from sin is based on a number of things:
1 – Knowledge of how reprehensible and vile it is, and that Allaah has only forbidden it as a protection against its evil, just as a caring father will protect his child from things that will harm him. This reason will make the wise person refrain from it, even if he does not pay attention to the warning of punishment.
2 – Feeling shy before Allaah, may He be glorified. If a person realizes that Allaah is watching him and can see him and hear him, he will feel too shy before his Lord to expose himself to His wrath.
3 – Remembering the blessings He has given you and His kindness towards you. Sins inevitably take away blessings. No person commits a sin but one of the blessings of Allaah is taken away because of that sin. If he repents, then it is restored, but if he persists in it, it is not given back to him, and the sins continue to take away blessings until the blessings disappear altogether. Allaah says (interpretation of the meaning):
“Verily, Allaah will not change the (good) condition of a people as long as they do not change their state (of goodness) themselves (by committing sins and by being ungrateful and disobedient to Allaah)” [al-Ra’d 13:11]
The greatest of blessings is faith, but the sins of zina, stealing, drinking alcohol and robbery take them away and cause them to disappear. One of the salaf said: I committed a sin and I was deprived of praying qiyaam for a year. Another said: I committed a sin and I was deprived of understanding of the Qur’aan. Concerning such things it was said:
If you have been blessed then take care of it, for sin takes away blessings.
To sum up: Sin is a fire that consumes blessings, just as fire consumes wood, Allaah forbid that His blessings be lost.
4 – Fear of Allaah and of His punishment. This may be established by believing in His promises and warnings, and by believing in Him, His Books and His Messengers. This is strengthened by means of knowledge and certain faith, and it is weakened if those two things are weakened, Allaah says (interpretation of the meaning):
“It is only those who have knowledge among His slaves that fear Allaah”[Faatir 35:28]
One of the salaf said: Fear of Allaah is a sign of knowledge and taking Allaah’s forgiveness for granted is a sign of ignorance.
5 – Love of Allaah. This is the strongest factor in being patient in refraining from disobeying Him. The one who loves will be obedient to the one whom he loves. The stronger that love grows in his heart, the more his willingness to obey Him and his unwillingness to disobey Him will grow. Sin and disobedience stem from weakness of love. There is a difference between one who is motivated to avoid disobeying his master because of his fear of his whip and punishment, and one who is motivated to avoid that because of his love for his master.
6 – Nobility and purity of heart. If a person has self-respect and is keen to attain virtue, he will refrain from anything that may lead to doom and dishonour.
7 – Certain knowledge of the consequences of disobedience and the harm that may result from it, such as blackening of the face, darkness in the heart, distress, grief, pain, depression, anxiety, lack of focus, weakness in the face of one’s enemy, confusion, sense of abandonment, being overpowered by one’s enemy, failing to benefit from knowledge, forgetting what one has already learned, and sickness that will surely lead to death if it takes hold, because sins deaden the heart.
To sum up: the awful effects of sin are too many for a person to grasp, and the good effects of obedience are too many for a person to grasp. The best of this world and the Hereafter may be attained by obeying Allaah, and the worst of this world and the Hereafter comes from disobeying Him. Concerning some of these effects Allaah says (interpretation of the meaning): “Who could ever obey Me and be doomed because of it and who could ever disobey Me and attain blessings because of it?”
8 – Lack of worldly hope and certainty that he will soon depart this world, and the realization that he is like a traveller who enters a town determined to leave it, or like a rider who rests in the shade of a tree then moves on and leaves it. Because he knows how short his stay will be and how quickly he will move on, he is keen to leave behind anything that may weigh him down or cause him harm and bring no benefit. He is keen to move on with the best that he has. A person has nothing better than a lack of worldly ambition and nothing more harmful than procrastinating and focusing on worldly ambitions.
9 – Avoiding excess in his food, drink, clothing, sleeping, and meeting people, because the temptation to commit sin grows stronger if there is any excess in these areas, because that requires an outlet and what is permissible becomes no longer enough and one begins to transgress into haraam areas. One of the most harmful things for a person is idleness and free time, because the soul is never idle; if it is not kept busy with beneficial things it will inevitably occupy itself with harmful things.
10 – This sums up all the previous things: it is faith that is firmly-rooted in the heart. Patience in refraining from sin depends on strength of faith. The stronger a person’s faith is, the more patient he will be, but if his faith is weak his patience will be weak too. If a person’s heart is filled with the belief that Allaah is watching him and can see him, and has forbidden what He has forbidden to him and will be angry with the one who does it and punish him, and if his heart is filled with the belief in the reward and punishment, Paradise and Hell, then he will not fail to act upon this knowledge. Whoever thinks that he can give up sin without firm and deeply-rooted faith is mistaken. If the lamp of faith is strong in the heart it will illuminate all of its corners and shine its light into its depths; that light will then spread throughout his body and he will respond quickly to the promptings of faith, and will obey humbly and willingly, with no resentment. Rather he will rejoice in this call when it comes, just as a man rejoices in the call of his beloved who calls him to show him kindness and honour him, so he is waiting for his call all the time. Allaah bestows His mercy upon whomsoever He will … End quote.
[Tareeq al-Hijratayn (p. 408-414)]