Less than 10 seasons. I think the absolute limit would be about 8 - hell, maybe even 6.
I admire the restraint of a TV show that tells its story, and then stops.
My girlfriend is a big fan of Grey's Anatomy, and that is currently airing its seventeenth season. Seventeen!
With a show like Grey's, or something like The Walking Dead, where characters are constantly joining/leaving the show, when all of the main cast of characters from the first couple of seasons have left, that is probably when it is time to stop. Same goes for shows where the main villain has been stopped, or the main goal has been reached. Once that has been accomplished - end it. I don't want to see The Fire Lord get defeated, only to end up with the Flame King take his place, and have the show go on for another 3 seasons. It's done. Finish it.
I absolutely refuse to watch any of the longer-running anime, where they have hundreds of episodes, because I will find it hard to get invested in a conflict that is established in episode 1, knowing it will be completely irrelevant by episode 100 - let alone by episode 200, or 300 and beyond.