One play by Shakespeare that definitely seems to resemble sonnet 146 in imagery and themes is Hamlet, although King Lear might also be a contender in this contest.
Sonnet 146 is concerned with sin, spiritual corruption, bodily decay, and beauty that proves to be merely superficial. The poem is also concerned with human pride (or vanity) and with the briefness of human life (mutability). The sonnet confronts in quite bleak terms the physical consequences of death. Finally, the sonnet suggests that humans should focus their brief lives on spiritual goals. If they do so, the poem suggests, death can be defeated.
Many of these same themes, and much of this same imagery, can be found throughout Hamlet. A particularly good example is the “grave-digger” scene (V.i). In that scene, Hamlet takes from a grave-digger the unearthed skull of a man (Yorick) with whom he once played when he was a boy. In his famous speech on Yorick, he reflects on the brevity of human life, the superficiality of human beauty, and the vanity of human pride (183-217). Elsewhere in the play, especially in his heated confrontation with his mother (III.iv), Hamlet is obsessed with ideas of sin and spiritual corruption. The entire play (one of Shakespeare’s darkest) resembles sonnet 146 in its bleak themes and imagery, but the ending of the play also resembles sonnet 146 in its somewhat hopeful conclusion. Hamlet seems to be a different, generally better man as the play draws toward its ending than he was in the first four acts. He seems more willing to trust in providence, and he seems less bitter toward his mother. It seems significant that Horatio, in the last words he addresses to the dead Hamlet, says, “Good night, sweet prince, / And flights of angels sing thee to thy rest” (V.ii.361-62).
Sylvan Barnet, ed., The Complete Signet Classic Shakespeare (New York: Harcourt Brace Jovanovich, 1972).
Cheney, Patrick, ed. The Cambridge Companion to Shakespeare’s Sonnets. Cambridge: Cambridge University Press, 2007.
Schoenfeldt, Michael, ed. A Companion to Shakespeare’s Sonnets. Malden, MA: Blackwell, 2007.