Basically the devil keeps moving back into you because along the way you fail to make proper corrections, judging yourself.
Each of us have to continually judge ourselves ... (I Cor. 11:31)
And
even when you knew "something" was wrong, I doubt you cried out to God
asking HIM what was wrong. If you had, I believe God would have shown
you.
But it doesn't matter enough to you yet ... and it is a way of life and habit with you to live this way. But it is a wrong way.
It
takes a lot of effort to keep ourselves. We can't afford to be lazy
(slothful) ... Satan as a roaring lion seeking whom he may devour.
Few find way of life for it take work and diligence ... lots of it ...