Answer: The first thing to consider in how to overcome habitual sin is
to note the change, or transformation, that takes place when a person is saved.
The Bible describes the natural man as "dead in sin and trespasses" (Ephesians
2:1). As a result of Adam's fall into sin, man is born spiritually dead. In
this state of spiritual death, man is unable and unwilling to follow and obey
God and habitual sin naturally follows. Natural man sees the things of God as
foolishness (1 Corinthians 2:14) and is hostile toward God (Romans 8:7).
When a person is saved, a transformation takes place. The apostle Paul refers
to this as the new creation (2 Corinthians 5:17). From the moment we place
our faith in Christ, we are in the process of sanctification.
The process of sanctification is that by which those who are in Christ are conformed by the Holy Spirit into the image of Christ (Romans 8:29). Sanctification in this life will never be fully complete, which means that believers will always struggle with remaining sin. Paul describes this battle with sin in Romans 7:15-25. In that passage he notes that, even though he desires to do what is good in the eyes of God, he often does what is evil instead. He does the evil he doesn't want to do and fails to do the good that he wants to do. In this, he is describing every Christian's struggle with sin.
James says we all sin in many ways (James 3:2). Experience tells us that we struggle differently with sin, perhaps one sin being more of a tripping point for one believer than another. For some it might be anger whereas for others it is gossip or lying. We might refer to a sin that is particularly difficult for us to overcome as a "besetting" sin or a "habitual" sin. These besetting sins are often, but not exclusively, habits that we developed during our lives as unbelievers and require more grace and discipline to overcome.
Part of the process of overcoming these habitual, or besetting, sins is in recognizing the transformation that has indeed taken place within the believer. Paul writes, "So you also must consider yourselves dead to sin and alive to God in Christ Jesus" (Romans 6:11). When Paul says, "Consider yourselves dead to sin," he is telling us to remember that, in coming to Christ, the power of sin has been broken in our lives. He uses the metaphor of slavery to make this point. We were at one time slaves to sin, but now we are slaves to righteousness (Romans 6:17-18). At the cross the power of sin was broken, and, in becoming Christians, we are set free from sin's mastery over us. Therefore, when a Christian sins, it is no longer out of the necessity of his nature, but because he has willfully submitted himself to sin's dominion (Galatians 5:1).
The next part of the process is recognizing our inability to overcome habitual sin and our need to rely on the power of God's Holy Spirit, who dwells within us. Back to Romans 7. Paul says, "For I know that nothing good dwells in me, that is, in my flesh. For I have the desire to do what is right, but not the ability to carry it out" (Romans 7:18). The Christian's struggle against sin is one in which our ability does not match our desire. That is why we need the power of the Holy Spirit. Paul later says, "If the Spirit of him who raised Jesus from the dead dwells in you, he who raised Christ Jesus from the dead will also give life to your mortal bodies through his Spirit who dwells in you" (Romans 8:11). The Holy Spirit, through God's Word (John 17:17), works sanctification in the people of God. Habitual sin is overcome as we submit ourselves to God and refuse the temptations of the flesh (James 4:7–8).
Another part of the process of overcoming habitual sin is to change the habits that facilitate it. We have to adopt the attitude of Joseph who, when tempted by Potiphar's wife to come to bed with her, left the room so quickly that he left his cloak in her hands (Genesis 39:15). We simply must make every effort to run from the things that tempt us to sin, including access to food if we are given to overeating, and access to pornography if we are tempted to sexual sin. Jesus tells us to cut off our hand or pluck out our eye if they "offend" us (Matthew 5:29–30). This means removing from our lives the things that tempt us to sin even when those are things we enjoy. In short, we have to change the habits that lead to habitual sin.
Finally, we need to immerse ourselves in the truth of the gospel. The gospel is not only the means by which we are saved, but it is also the means by which we are sanctified (Romans 16:25). If we think we are saved by grace, but sanctified by our own efforts, we fall into error (Galatians 3:1–3). Sanctification is as much a work of God as justification. The promise we have from Scripture is that He who began a good work in us will complete it on the last day (Philippians 1:6).