Do you remember the first time you realized that it was possible to have too much of a good thing? When you were just a kid and woke up the day after Halloween surrounded by empty candy wrappers and a belly ache?

What about when it dawned on you that it was possible to overstay your welcome and that your party antics that seemed droll at 10 p.m. were probably less entertaining at 3 a.m.?

These are lessons that most everyone learns eventually but often seem to elude television series. Far too many great shows end up with diminished returns because they just don’t know when to pull the plug.

Take “The Good Wife,” which ran for five great seasons on CBS. And then for two not-so-great more. How on earth could its new spinoff, “The Good Fight,” mine more stories from a show that already ran its course?

But it turns out “Fight” has done exactly that since it debuted on CBS All Access last month to critical acclaim that suggested creators Robert and Michelle King still had the “Wife” magic; they just needed a clean slate. CBS is so pleased with the series that it renewed the show for a second season Wednesday.

Maybe this is precisely how television should save its favorite shows from languishing — by forcing every show to quit after its fifth season.

Think about how many could have been revitalized by that strategy.

“Friends” ran for 10 seasons, but by the end of the fifth one, Monica and Chandler were together and Ross and Rachel were drunkenly married. End the series there and Monica and Chandler could have starred in their own “Odd Couple”-like vehicle. Bonus? It would have spared the world the spinoff “Joey” and Matthew Perry’s actual “Odd Couple” series.

Then again, not every show needs or warrants a spinoff. “The Walking Dead” is currently zombie-limping through its seventh season and has already spawned “Fear the Walking Dead.” But does the world really need two “Walking Dead” shows? No.

Oh, sure, “MASH” is a beloved show with one of the most-watched finales of all time. But it ran for 11 seasons, and the Korean War, during which the series was set, lasted only three years. End it at the fifth season and the 4077th team moves on to Vietnam for the most depressing spinoff ever.

Are there shows that were good past their fifth seasons? Absolutely. Television sometimes builds a universe you’d be happy visiting indefinitely, like “The Mary Tyler Moore Show” or “Mad Men” did. But most shows could find new life by bowing out gracefully only to start again better than ever.