Answers 2Add Yours
The couplet uplifts the tone of the poem because no matter what is wrong (and many of the depressing things in the author's life are listed in the earlier quatrains), the author has someone to think about which then gives him a happier feeling. Any loss the poet feels is returned to him (restored) and he feels that there is nothing else to feel sorrowful about.
"But if the while I think on thee, dear friend,
All losses are restor'd and sorrows end."
There is the tone of solace in the memory of the person. Though the speaker feels sad, the memory keeps him going.