
A sermon on Psalm 40 by Rev Richard Keith on Sunday, 18 January, 2026
The psalms are songs. They show us how to worship the true and living God. But they aren’t just songs. Many of the psalms are also prayers. They don’t just talk about God, they address him directly. And so the psalms don’t just guide us in worship. The psalms teach us to pray. They teach us how to communicate with our creator and saviour.
And Psalm 40 is a good example. It teaches us that prayer is more than telling God how wonderful he is. It teaches us that prayer is more than asking God for the things we need. Psalm 40 teaches us that prayer is all these things and more. It brings together the different elements of prayer and shows us how to balance them in our own prayer life. Let’s see what we can learn about prayer this morning from Psalm 40.
Psalm 40 is a psalm of David. It begins, “I waited patiently for the Lord; he turned to me and heard my cry. He lifted me out of the slimy pit, out of the mud and mire; he set my feet on a rock and gave me a firm place to stand. He put a new song in my mouth, a hymn of praise to our God. Many will see and fear and put their trust in the Lord.”
David begins his psalm with a testimony of rescue. He was in what he calls the slimy pit. He calls it mud and mire. It’s not a literal hole in the ground. It’s David’s description of a time of distress and fear, a situation that was unstable and dangerous. Perhaps he was sick with no hope of recovery. Perhaps he faced countless foes on the battlefield. Perhaps he had been outmaneuvered in court, betrayed or trapped by those who wanted him gone. Whatever it was, David was beyond his own means to help himself. And so David cried out to the Lord for help.
And then he did two remarkable things. Firstly, David waited patiently. Our modern culture is losing its ability to wait patiently. We live in the era of fast food and sound bites and instant gratification. But David waited patiently for God. It is not weak or passive, but active and decisive to choose to trust in our heavenly Father who knows what we need before we ask him. Waiting patiently on God is not about doing nothing. It’s about placing our cares in his hands because he cares for us. And so while we wait, we can still go to work, care for our families, fulfill our responsibilities, but we do so with peace instead of panic, trusting God to handle what only He can.
At just the right time the Lord gave David the help he needed. Lifting him out of the desperate situation. Giving him stability and security when he needed it most.
Then David did the second remarkable thing. He testified publicly to what the Lord had done. David said, “The Lord put a new song in my mouth.” This new song isn’t just new words put to different music. It’s a hymn of praise to God. David calls it a new song because when the Lord does something remarkable to help his people in an extraordinary way, the old songs of praise no longer seem adequate to speak of the power and love of God. The Lord’s fresh mercies demand fresh expression. And so David sang the new song so that others could hear it, so they could know what the Lord is prepared and able to do for those who love him and put their trust in God as well.
It reminds me that there is no greater witness to the Christian hope of life in Jesus than enthusiastic singing at a funeral. At a Christian funeral we can truly celebrate the life of the deceased because we know its not the end of their story. We also celebrate the gift of new life from God in Jesus. With this hope we find the courage to shed a tear and have a laugh because we know that God has the last laugh over death through the cross of his Son. And we also find the courage to sing, to praise God in the presence of death because God is greater. When people hear that hope in the singing, it encourages them to confront their own feelings of hopelessness and put their faith in God.
That’s what David is talking about in Psalm 40. When God rescues his people, their praise doesn’t stay private. It becomes a witness. Others see it. Others hear it. And some are led to trust the Lord for themselves.
In verses 4 and 5, David gives a blessing. “Blessed is the man who makes the Lord his trust, who does not look to the proud, to those who turn aside to false gods. Many, O Lord my God, are the wonders you have done. The things you planned for us no one can recount to you; were I to speak and tell of them, they would be too many to declare.”
David pronounces a blessing firstly on those who trust the Lord. They are blessed because they turn to the true and living God for their security and their identity. The Lord is their trust. All their hopes are put in him. They don’t turn to the proud and arrogant, those who trust in their own strength, their own wisdom. And they don’t offer their worship to false gods. These are the idols we create when we put our ultimate trust in money, success, reputation, or comfort. Instead, they have made the Lord the number one in their life. They believe his words and they obey his commands. They are blessed because God can do for them what he did for David when he rescued him from the pit.
And David pronounces secondly a blessing on the Lord himself, offering his praise to the one whose wonders are countless, and whose plans for us are beyond what words can convey. In Psalm 40 David praises the Lord because the rescue he experienced from the slimy pit is only one of many answers to prayer that he has received. We call those moments when God intervenes in our lives miracles. To us they are remarkable. They leave us speechless. But to the Lord they are business as usual. Every day he showers us with blessings, many that we take for granted. But if we tried to count them they would be, as David says, too many to declare.
In verses 6 to 8 David responds to the Lord’s many blessings with a commitment to obedience. He writes, “Sacrifice and offering you did not desire, but my ears you have pierced; burnt offerings and sin offerings you did not require. Then I said, ‘Here I am, I have come – it is written about me in the scroll. I desire to do your will, O my God; your law is within my heart.'”
David isn’t saying that God rejects sacrifices and offerings. After all, God himself commanded them in the law. Rather, David understands that God never wanted empty ritual. The sacrifices were always meant to be outward expressions of inner realities: genuine repentance, heartfelt praise, true commitment to the Lord.
What God desires is the whole person, heart and hands together. Because we are physical beings, what we do with our bodies really matters. But because we are also spiritual beings, our actions must flow from our hearts, from our attitudes and values, and from the choices we make.
David says to the Lord, “My ears you have pierced.” This is the language of willing, lifelong service. In the Old Testament if a person ran out of money and couldn’t pay their debts they could sell themselves into service to a fellow Israelite to work on their farm. But that was never permanent. It was for six years and then they could go free. But if a servant came to love his master’s household and wanted to stay, he could choose to stay permanently. The law says in Exodus chapter 21, “If the servant declares, ‘I love my master and do not want to go free,’ then his master must take him before the judges. He shall take him to the door or the doorpost and pierce his ear with an awl. Then he will be his servant for life.”
Notice what drives this decision: “I love my master.” This isn’t servitude compelled by debt or force. This is willing service, chosen out of love. The pierced ear becomes a permanent mark of voluntary devotion.
That’s what David is saying to God in Psalm 40: “You have pierced my ear.” He’s declaring that his obedience isn’t grudging compliance with religious duty. It’s the wholehearted response of someone who has experienced God’s rescue and now chooses to serve him for life, not out of obligation, but out of love. David says to the Lord, “Here I am.” He offers him all he is and all he has in willing, lifelong service. David is likely king of Israel at the time of writing Psalm 40 but he acknowledges the Lord as high king over him. The scroll David mentions likely refers to the book of Deuteronomy which outlines the duties of the king, but he wants to do more than just obey the letter of the law. He wants to do God’s will. He declares that God’s law is not just written on the page of the Bible, but has become part of who he is, shaping his thoughts and attitudes.
David’s words in Psalm 40 are deeply personal. A king’s commitment to serve the God who rescued him. But they’re also prophetic. These verses point forward to someone greater than David, someone who would fulfill this commitment perfectly.
The writer of Hebrews quotes these very words and applies them to Jesus. In Hebrews chapter 10, we read that when Christ came into the world, he said: “Here I am, I have come to do your will, my God.” What David could only approximate, Jesus accomplished completely. Where David offered willing service marked by a pierced ear, Jesus offered willing sacrifice marked by pierced hands and feet. Where David sought to align his heart with God’s will, Jesus perfectly embodied that will in every word and action. And where the animal sacrifices of the Old Testament could never truly take away sin, Jesus’ once-for-all sacrifice did what those rituals could only picture.
This is why our commitment to obey God is never about earning his favour. Jesus has already done that for us. Rather, our obedience flows from gratitude, the grateful response of those who have been rescued, not by our own merit, but by Christ’s perfect sacrifice. Like David, we say “Here I am,” not to save ourselves, but because we’ve already been saved.
In verses 11 and 12 David offers up words of lament. “Do not withhold your mercy from me, O Lord; may your love and your truth always protect me. For troubles without number surround me; my sins have overtaken me, and I cannot see. They are more than the hairs of my head, and my heart fails within me.”
David began his psalm with words of praise because he was rescued by the Lord. But his troubles have continued. Some of them are his own fault and he is suffering the consequences of his own choices. But one thing David did is he didn’t stop praying. He didn’t try to suppress his feelings or to deny his suffering, but he remained honest with God about his situation. Commitment to God doesn’t mean the end of problems. It doesn’t mean that we’ll never have to ask for help again. Instead it means that we keep coming back to him in praise when we are rescued, in lament when struggling again.
And notice what David doesn’t do here. He doesn’t let his sin become a barrier between him and God. He doesn’t say, “Well, I’ve messed up, so I have no right to pray anymore.” He doesn’t withdraw in shame or try to clean himself up before coming to God.
Instead, David brings his sin into his prayer. “My sins have overtaken me,” he confesses honestly. And in the same breath he asks, “Do not withhold your mercy from me, O Lord.”
This is a trap many of us fall into. We think we need to get our act together before we can pray. We let guilt keep us from the very relationship that could heal us. But David shows us that honest confession and asking for help go hand in hand. God already knows our sin. What he wants is for us to keep talking to him about it.
Prayer is many things. It is praise. It is a testimony to unbelievers. It is an offering of commitment. It is baring our soul to our creator and our redeemer. But it is also petition. It is asking for the things we want and need. Which David does in the closing verses of Psalm 40. “Be pleased, O Lord, to save me; O Lord, come quickly to help me. May all who seek to take my life be put to shame and confusion; may all who desire my ruin be turned back in disgrace. But may all who seek you rejoice and be glad in you; may those who love your salvation always say, ‘The Lord be exalted!'”
David’s mistakes have made him vulnerable. His enemies are seeking his life, desiring his ruin. He’s in trouble again, and he needs God’s help. And he’s not afraid to ask for it.
But notice how David prays. His enemies aren’t instruments of righteous judgment. They are opportunists exploiting his weakness for their own malicious purposes. So David makes his appeal to the Lord not on the basis of his own righteousness, because he’s already confessed he has none. He makes his appeal on the basis of God’s character and God’s purposes. “Be pleased, O Lord, to save me,” he prays, appealing to God’s unfailing love and faithfulness, not to his own merit.
And David frames the conflict in kingdom terms. “May all who desire my ruin be turned back in disgrace. But may all who seek you rejoice and be glad in you.” David understands that as God’s anointed king, attacks on him are ultimately attacks on God’s purposes. His prayer isn’t “vindicate me because I’m right” but “vindicate yourself, O Lord. Show that your kingdom plans prevail over those who oppose them.” So when God rescues David, those who seek the Lord will rejoice and say, “The Lord be exalted!” This is what David wants, not just personal safety, but God’s glory demonstrated through deliverance.
This is prayer the way it’s meant to be: honest about our sin, confident in God’s mercy, and trusting that God’s purposes are bigger than our failures.
We’ve all had that friend who only calls when they need something. They’re silent for months, and then suddenly your phone rings. They need money, a favour, a ride to the airport. It feels transactional. It doesn’t feel like friendship.
Sometimes we treat God the same way. We only pray when we’re desperate, when we need rescue from our own slimy pit. And then we wonder why our prayer life feels shallow, why it doesn’t sustain us through the ups and downs of life.
But Psalm 40 shows us what prayer really looks like. It’s not just asking God for help when we’re in trouble. Prayer includes praise, celebrating what God has done. It leads to testimony, sharing God’s faithfulness with others. It includes commitment, offering our wholehearted obedience out of love. It includes lament, being honest about our struggles and our sin. And yes, it includes bringing our needs and our failures to God.
This is the rich, full relationship God invites us into. Not a phone call when we’re desperate, but an ongoing conversation with the one who rescued us, who deserves our praise, who calls us to serve him, and who welcomes us back even when we’ve failed.
So may we learn to pray like David: honestly, confidently, and continually, trusting that God’s purposes are bigger than our failures and that his mercy is greater than our sin.