Shared ground
These verses present the speaker’s amazement at what God “thinks” and at how personally valuable those thoughts are. The text explicitly claims (1) God’s thoughts are “precious” to the speaker, (2) they are overwhelmingly many, and (3) God’s relationship with the speaker continues through ordinary rhythms like sleeping and waking.
The sand comparison functions as everyday language for “more than can be counted,” not as a measurable statistic. The overall movement is from value (“precious”) to scale (“vast”), ending with steadiness (“still with you”).
Where interpretation differs
What “your thoughts” refers to. Some read “your thoughts” mainly as God’s plans or purposes for the speaker (fitting the earlier focus on God’s shaping of the speaker’s life in Psalm 139:13–16). Others read it more broadly as God’s ongoing attention, awareness, and mind toward the speaker—God’s constant knowing and regard.
What “I am still with you” emphasizes. Some take it mainly as the speaker’s renewed awareness after sleep (waking to find his mind returned to God). Others take it mainly as God’s continued presence and nearness (the relationship remains intact regardless of sleep).
Why the disagreement exists
The key phrases are poetic and compact. “Thoughts” can naturally mean plans, intentions, attention, or what God says to a person; the poem does not specify one category. Likewise, “still with you” can describe either the speaker’s perspective (“I find myself with you again”) or God’s unbroken nearness (“you have not left”). The surrounding psalm supports both themes—God’s detailed knowledge and God’s steady presence.
What this passage clearly contributes
The passage contributes a strong claim about God’s personal engagement: God is not distant or indifferent in the speaker’s experience. It also portrays that engagement as both valuable (the speaker treasures it) and immense (beyond counting, pictured by “sand”). Finally, it links God’s nearness to ordinary life: even after unconsciousness in sleep, the speaker speaks as one who remains “with” God, highlighting continuity rather than a momentary spiritual high.