If ye keep my commandments, ye shall abide in my love; even as I have kept my Father's commandments, and abide in his love.
Note 56 at Joh 15:10: God's love was commended toward us while we were yet sinners (Ro 5:8). We certainly weren't keeping the commandments of God then. Therefore, keeping the commandments doesn't affect God's willingness to love us, but it does affect our awareness of how much God loves us.
If we live in sin, our consciences become defiled and condemn us (Ro 2:15). That's not God condemning us (Ro 8:1 and 34) but our consciences. God still loves us (Ro 8:35-39). John was speaking of this same thing in 1Jo 3:20 when he said, "For if our heart condemn us, God is greater than our heart, and knoweth all things." However, as far as this earthly life goes, our awareness of God's love is everything. Therefore, 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 (Ro 6:16). John went on to say in 1Jo 3:21, "Beloved, if our heart condemn us not, then have we confidence toward God." Holiness is very important in keeping our hearts assured of the love of God (1Jo 3:19), and this is what Jesus was referring to.