Have you ever wondered why God sometimes allows us to struggle with some sins even after we have prayed desperately for relief?
In his book Of The Mortification of Sin in Believers John Owen writes of one reason that God leaves sin our life.
Sometimes God will leave us “under the perplexing power at least of some lust or sin, to correct them for former sins, negligence, and folly”. God will sometimes leave us with a sin so as to reveal to us the existence of negligence in our lives, of folly, or of unrepentant sin. Sometimes it may be fitting for us to examine our hearts and our ways. “What was the state and condition of your sould before you fell into the entanglements of that sin which now you so complain of? Have you been negligent in duties? Have you lived inordinately to yourself? Is there the guilt of any great sin lying upon you unrepented of? A new sin may be permitted, as well as a new affliction sent, to bring an old sin to remembrance.”
Owen discusses this in chapter 9 of Of the Mortification of Sin in Believers.
 John Owen, Overcoming Sin & Temptation (Wheaton, Ill: Crossway Books, 2006), 94.
 Ibid., 95.