Let this truth blow your mind. Read what Rick Gamache, says in his sermon “Whiter Than Snow”
But our sin affects our relationship with God. Our sin breaks our fellowship with God. David realizes that before he ever committed adultery with Bathsheba, he committed spiritual adultery against God. Why did he need her? Why was he willing to murder his own friend for her? It is because before David ever sinned against Bathsheba and Uriah, he lost the joy of his salvation. That is why he asks for the joy to be restored [Psalm 51:12].
We sin because we forget God’s steadfast love and abundant mercy. When we are not ravished by him, we forget the superior pleasures that there are in God and give ourselves to the inferior pleasures of sin. And this is why David says, “Against you God, you only have I sinned.” He goes deep with his confession because he knows repentance is the way back to fellowship with God.
I think it is absolutely amazing and very telling, given what we know about the situation, that David never mentions sexual sin in Psalm 51. He’s not mainly praying that the Lord would provide him with good accountability. He’s not mainly praying that God would give him self-control and protect his eyes and his mind. Those are all good things. But David does not mention them here because his sexual sin — and every sexual sin — is the symptom of the disease not the disease. Sexual sin is a symptom of lack of fullness of joy and gladness in Jesus. It’s a symptom of a lack of being ravished by the love and kindness and mercy and goodness and beauty and excellence and majesty and glory and honor and power of God.