Shakespeare wrote 38 plays.
However, publisher Arden Shakespeare recently added a new play to their collection: the publication of Double Falsehood under Shakespeare’s name technically revises the total number of plays to 39!
The problem is that we don’t have a definitive record, and it is likely that many of his plays were written in collaboration with other writers.
It will take time for Double Falsehood to be fully incorporated and accepted into the Shakespeare canon, which means that it is generally accepted that Shakespeare wrote 38 plays in total. The total number of plays is periodically revised and often disputed.