Sonnet 30 is most well-known for its first two lines, particularly the second line--"remembrance of things past"--because it provided the title for a novel by Marcel Proust.
The central theme of the sonnet is the poet's pervasive sense of loss:
I sigh the lack of many a thing I sought,/And with old woes new wail my dear time's waste:/Then can I drown an eye, unused to flow,/For precious friends hid in death's dateless night. . . .
Looking back on his life, the poet regrets his failure to achieve many things he wanted, including the loss of years in the attempt to achieve those things. In lamenting the loss of friends, he uses the fairly conventional metaphor comparing death to an endless night ("friends hid in death's dateless night").
The simple fact of remembering his losses, moreover, recalls them to his mind, which causes new torment--"and weep afresh love's long since cancell'd woe"--and, with the word cancell'd, the poet begins an extended metaphor comparing his loss of the past to monetary losses.
Scholars have discussed both the legal terms--"sessions" in line 1--and the banking and accounting terms, but I think the accounting metaphor is the more obvious comparison: "cancell'd woe," "expense of many a vanish'd sight," "woe to woe tell oe'r," "sad account," "which I new pay," and "all losses are restored." These are the terms of commerce, of banking, of accounting--as if the losses can be managed as one manages a monetary account.
When we reach the couplet, the losses on the poet's account are made whole:
But if the while I think on thee, dear friend,/All losses are restored and sorrows end.
The controlling metaphor of the sonnet, then, is the comparison of the intangible losses of memory, the death of friends, to the tangible elements of a commercial account--cancelled note, expenses, accounting, payables and payment--but the important point is that all these problems are resolved, made whole, by the simple expedient of thinking about the poet's "dear friend."