Psalm 39 is a Psalm of David, though it cannot be connected to any specific point in his life. It is possible that it's from later in his life, in his last few years.

This psalm is of great interest for how it begins, and for how it ends.