He's going to stay on until the end of the next season.
In my opinion, he's not the biggest problem - the writing on the show has completely gone downhill. This past season was unwatchable. There's plenty of funny people to replace Michael Scott, but if the writers don't put these people in position to succeed, the show will undoubtedly be canceled.