The real answer to this question is that, while we know that Shakespeare was a respected actor and was writing plays at the same time as he was a member of The Chamberlain's Men, an acting troupe of high repute, we do not know which roles he may specifically have played. In the introduction to the First Folio, there is a list of "the principall actors in all the plays," the chief of whom is William Shakespeare himself. Therefore, we can be fairly sure that Shakespeare did indeed act in some or all of the plays contained in the First Folio, but we have no concrete information as to which roles he may have inhabited.
Nicholas Rowe, an actor who went on to write the first critical edition of Shakespeare's works, referred to Shakespeare as "the Ghost in his own Hamlet." However, this could equally have been meant metaphorically, rather than literally: we might read this to mean that Shakespeare put much of himself into the background of all his great plays, but never stole the spotlight.