A team's inning isn't over until there are three outs.
As long as there aren't three outs, a team can go through as many rotations until three outs happen.
The first player will be the tenth player, second player will be the eleventh player, etc.

"The Boston Red Sox had 23 batters go to the plate in the 7th inning against Detroit on 07/18/1953. They scored 17 runs and had bases loaded when the inning ended."

https://answers.yahoo.com/question/index?qid=20090816160525AAg3UDP