While it is true that God loves us in spite of us, we ought to strive to please Him so that His sentiment will change to because of.
Of course, we cannot earn His love, but it seems true from the Bible that we can live in such a way to further arouse His love for us. Listen to the promise He made to the Israelites:
“Therefore you shall keep his statutes and his commandments, which I command you today, that it may go well with you and with your children after you, and that you may prolong your days in the land that the Lord your God is giving you for all time.” Deut. 4:40
It’s like this. I will always love my children no matter what. However, they are far more pleasing to me when they are obedient and well-behaved than not.
Do not take God’s grace to be a license to sin. Rather, take God’s grace and apply it everywhere until you are happy in Him and become naturally pleasing in His sight.
Last Saturday, as I was doing my long run, I recollected all of God’s favor He has shown to me, and that made me want to further hold onto Him and be pleasing in His sight.
You are never happier than when you are happy in God.