Praise be to Allah.
When Allaah forbids people to commit sin, He did not leave them without help to do so. He supplies them with means that help them to give up that action. Among these helpful means are:
1-Strengthening one’s faith in Allaah and one's fear of Him.
2-Knowing that Allaah is always watching and bearing in mind that He is with you; He can see you and everything that you do is being recorded.
3-Comparing and contrasting the fleeting pleasure of sin which quickly fades, with the punishment of the sinner on the Day of Resurrection, and the reward of the one who refrained from sin.
4-Keeping away from the things that help one to sin, such as haraam looks, bad company, going to sinful places.
5-Striving to keep company with righteous people.