Personification plays a very important part in the development of this famous sonnet in the way that it allows the speaker to personify both the sun and death as he develops his argument as to why comparing his beloved to a "summer's day" would actually be a very inadequate and inaccurate comparison to make.
Firstly, the sun is personified as the speaker talks about its many imperfections:
Sometime too hot the eye of heaven shines,
And often is his gold complexion dimm'd...
The sun is personified as a face which helps explain the way in which the "eye" of the sun can shine to hotly or its "gold complexion" can sometimes not be as bright and shiny as we would expect it to be. Personifying the sun helps the speaker develop the way in which the sun's imperfections make it an inadequate point of comparison for the beauty of his beloved.
In the same way, death is personified in the following quote:
Nor shall Death brag thou wander'st in his shade,
When in eternal lines to time thou growest...
As the capital letter and context illustrates, Death is personified as a man who boasts about the way in which everybody has to come near to him and finally confront him as they age and finally die. The speaker says that this poem will prevent this from happening as he is effectively capturing the beauty of his beloved and keeping it enshrined for all eternity away from the corrupting power of death and aging.