Shakespeare most likely wrote more plays than you think; some that aren’t included in your Complete Works of William Shakespeare. There isn’t a lot of original writings that have survived from Elizabethan England and dramatic literature is no exception.
Some of Shakespeare’s works were published in Quartos during his lifetime, about 18. Later on in 1623, the First Folio was published with 36 plays in it and was considered the first accurate source for Shakespeare’s text. Since then scholars have found evidence to attribute more plays to Shakespeare.
Your average Complete Works contains 37 plays, the First Folio only 36. The extra one is Pericles which was not yet published. Now we’re up to 37 plays without much argument. Two Noble Kinsmen was originally credited to Shakespeare and John Fletcher when first published in Quarto in 1634. Many accept that is was a joint effort between the two, but it isn’t included in some complete works editions. So far we’re at 38.
A fairly recent addition to Shakespeare’s Canon is Edward III, the 11th History play with lots of questions surrounding it. The play’s author was listed as Anonymous for several years and it was thought to have been written by a contemporary of Shakespeare. There was no written evidence to link it to any author or theatre company. Some scholars over the next few centuries thought it to be Shakespeare’s because “no one else could write something so good” – or something to that effect. Only in the 1990s with computer analysis and comparison with other works of Shakespeare, it was decided by some that Shakespeare had something to do with it. 39!
Another co-authorship is Sir Thomas More, handwriting analysis has shown that Shakespeare did write some of it. But not all of it. This play isn’t publish in many places, and almost never performed. 40.
So far I’ve only mentioned texts that still exist. Not everything from 400 years ago will survive, but there are small pieces of evidence that tell us of plays that did once exist. One of the “lost” plays is Love’s Labours Won, quite possibly a sequel to Love’s Labours Lost. I’d be surprised if the two weren’t related. The other is Cardenio, based on Don Quixote by Miguel de Cervantes. 42.
Other plays possibly attributed to Shakespeare (classified as The “Apocrypha”) include The Birth of Merlin, Locrine, The London Prodigal, The Puritan, The Second Maiden’s Tragedy, Richard II, Part I: Thomas of Woodstock, Sir John Oldcastle, Thomas Lord Cromwell, A Yorkshire Tragedy, Fair Em, Mucedorus, The Merry Devil of Edmonton, Arden of Faversham, Edmund Ironside, Vortigern and Rowena. Quite a list, but there’s not a lot of evidence there. If there’s an anonymous play from the 16th or 17th century people tend to think “Shakespeare must’ve writtten it.”
The number of plays William Shakespeare actually wrote during his lifetime may never be known, but anything that’s in a Complete Works of William Shakespeare, scholars are pretty darn sure about.
So the accurate answer to the title question is unknown; the closest answer that anyone can give you is probably 39, but none of us were there – the world may never know for sure.