For the director of music. With stringed instruments. A psalm of David.
4:1 [note four imperatives…]  Answer me when I call to you [this is a privilege reserved for God’s children], my righteous [a description of God’s nature; God’s righteousness is expressed as He relates to His people and gives them victory over adversity; cf. Ps. 18:46-48] God.  Give me relief from my distress [the particular nature of this distress is not specified];  have mercy [show favor and grace] on me and  hear my prayer.
Note: “It is not to be imagined that He who has helped us in six troubles will leave us in he seventh. God does nothing by halves, and He will never cease to help us until we cease to need. The manna shall fall every morning until we cross the Jordan.” (C.H. Spurgeon)
B. Call for Trust in the Lord [David speaks to his enemies]
4:2 [these verses give us insight into the unspecified “distress” of verse 1] How long will you people [or “men”; refers to the class of prominent citizens; those in position of leadership and influence] turn my glory [the leaders despised and scoffed at the position of the king] into shame? How long will you [those who opposed the king loved worthless things] love delusions and seek false gods?
4:3 [note David’s confidence…] Know that the Lord has set apart [God had chosen David to be His friend] his faithful servant for himself; the Lord hears when I call to him.
4:4 Tremble and do not sin [David exhorted his enemies to repent from their wicked way of life]; [admonition to his enemies to reflect on their lives in the silence of the night] when you are on your beds, search your hearts and be silent.
4:5 Offer the sacrifices of the righteous and trust in the Lord.
4:6 Many [unspecified; perhaps skeptics or those frustrated at waiting to see God’s covenant blessings], Lord, are asking, “Who will bring us prosperity? [expectations of covenant blessings; there are people who “have no notion of any happiness that does not come to them through the medium of their senses” (Adam Clarke)]” [the Lord is the author of blessings…] Let the light of your face [a reference to the benefits and blessings that result from God’s presence] shine on us.
4:7 Fill my heart with joy [a fruit of the Spirit (Gal. 5:22-23); “If I have all the world, I am poor without Him.” (CHSpurgeon)] when their grain and new wine abound.
D. Expression of Trust in the Lord
4:8 In peace [inward peace is a blessing that our enemies cannot take away] I will lie down [“in this ‘lying down’ … he voluntarily gave up any guardianship of himself” (Philip Bennet Power)] and sleep [David slept while his enemies lay awake at night as per verse 4; “They slumber sweetly whom faith rocks to sleep.” (CHSpurgeon)], for you alone, Lord [the giver of peace], make me dwell in safety.