Keeping the commandments doesn't affect God's willingness to love us, but it affects our awareness of how much He loves us. If we live in sin, our conscience becomes defiled and it condemns us. It's not God condemning us, but our conscience. God still loves us. John was speaking of this same thing in 1 John 3:20, when he said, "For if our heart condemn us, God is greater than our heart, and knoweth all things." As far as this earthly life goes, our awareness of God's love is everything. We must keep Satan from blinding us to the love of God.
The most effective way of doing this is to give no place to the devil through sin. John went on to say in 1 John 3:21, "Beloved, if our heart condemn us not, then have we confidence toward God." Holiness is important in keeping our hearts assured of the love of God (1 John 3:19). It's the nature of a Christian to walk in the light and not in darkness. When we are rightly informed of who we are and what we have in Christ, holiness just naturally flows out of us. That's our nature.