Complete Commentary on the Whole Bible, by Matthew Henry, at sacred-texts.com
(Psa 5:1-6) God will certainly hear prayer: David gives to God the glory, and takes to himself the comfort.
(Psa 5:7-12) He prayed for himself, that God would guide him, and for all the Lord's people, that God would give them joy, and keep them safe.
God is a prayer-hearing God. Such he has always been, and he is still as ready to hear prayer as ever. The most encouraging principle of prayer, and the most powerful plea in prayer, is, to look upon him as our King and our God. David also prays to a sin-hating God. sin is folly, and sinners are the greatest of all fools; fools of their own making. Wicked people hate God; justly are they hated of him, and this will be their endless misery and ruin. Let us learn the importance of truth and sincerity, in all the affairs of life. Liars and murderers resemble the devil, and are his children, therefore it may well be expected that God should abhor them. These were the characters of David's enemies; and such as these are still the enemies of Christ and his people.
David prayed often alone, yet was very constant in attendance on public worship. The mercy of God should ever be the foundation both of our hope and of our joy, in every thing wherein we have to do with him. Let us learn to pray, not for ourselves only, but for others; grace be with all that love Christ in sincerity. The Divine blessing comes down upon us through Jesus Christ, the righteous or just One, as of old it did upon Israel through David, whom God protected, and placed upon the throne. Thou, O Christ, art the righteous Saviour, thou art the King of Israel, thou art the Fountain of blessing to all believers; thy favour is the defence and protection of thy church.