There are many paragraphs in Scripture concerning the development of habits that keep a person from sin:
2 Cor 12.9
""My grace is sufficient for you, for power is made perfect in weakness." I will rather boast most gladly of my weaknesses, in order that the power of Christ may dwell with me."
2 Peter 1:3-10
"His divine power has bestowed on us everything that makes for life and devotion, through the knowledge of Him who called us by His own glory and power. Through these, He has bestowed on us the precious and very great promises, so that through them you may come to share in the divine nature, after escaping from the corruption that is in the world because of evil desire.
"For this very reason, make every effort to supplement your faith with virtue, virtue with knowledge, knowledge with self-control, self-control with endurance, endurance with devotion, devotion with mutual affection, mutual affection with love. If these are yours and increase in abundance, they will keep you from being idle or unfruitful in the knowledge of our Lord Jesus Christ. Anyone who lacks them is blind and shortsighted, forgetful of the cleansing of his past sins."
"Not only that, but we even boast of our afflictions, knowing that affliction produces endurance, and endurance, proven character, and proven character, hope, and hope does not disappoint, because the love of God has been poured out into our hearts through the holy Spirit that has been given to us. For Christ, while we were still helpless, yet died at the appointed time for the ungodly."