All of these verses are pure psychotherapy. He is talking to himself to bolster his appreciation of how much he has been blessed. Then he turns away from talking to himself and sends up a mighty petition to his Heavenly Father.