There are 154 surviving sonnets by William Shakespeare. There is no way of knowing if this is the total number of sonnets he wrote during his lifetime, as some could have been lost or unpublished.
Shakespeare's sonnets were first published in 1609 in a quarto edition entitled "Shake-speares Sonnets." The collection includes a dedication to "Mr. W. H." who is described as the "onlie begetter of these insuing sonnets." The identity of Mr. W. H. remains a mystery and a source of controversy. It is thought by some that Mr. W. H. is the subject of some of the sonnets, an unknown young man commonly known as the "Fair Youth" of Shakespeare's sonnets. It is also possible that Mr. W. H. was one of Shakespeare's benefactors, possibly William Herbert, the Earl of Pembroke.