As the druid or ranger goes up in levels, and therefore gains more potential animal companion hit dice, we allow the player to choose whether to keep the HD open for new companions, or add them to existing companions (up to 1 HD per companion per level). So once a druid with a wolf reaches 2nd level, he can add one HD to his wolf and keep the other free, or keep both free for new companions.
Once the animal reaches the max HD as listed for the MM for its' current size, then the druid ritual can advance it through the next size category. Once it reaches the animal's normal max HD and max size, that is as tough as it can get.
Unless you use legendary animals. Then I suppose you could incorporate that somehow also.
-Mark