Beastmaster PrC and Natural Bond feat from Complete Adventurer.
Natural Bond lets you boost your effective druid level for purposes of the Animal Companion by up to 3, but not more than your actual hit dice. (So it does nothing for a straight Druid.) This is excellent for the Ranger who wants to boost his Animal Companion to a useful power level for the lowish to middling levels.
The Beastmaster PrC lets you get a straight +3 with no limitation added to your effective Druid level. Theorectically a Druid could take this PrC but it is not really worth the prereqs (8 ranks Handle Animal + Sill Focus Handle Animal) except for roleplaying considerations.
The Beastmaster is an excellent choice for a Ranger.
Go 5 levels of Ranger, picking up Skill Focus at level 3. At level 6, pick up your first level of Beastmaster and Natural Bond. Your effective druid level for AC is now 9, giving you, say, an 8 HD Wolf (with piles of bonus abilities). You will probably trade up to a Dire Wolf or Lion, but that still keeps you in the ballpark of 7 or 8 HD and the beast probably is better in a straight fight than you are.
Beastmaster class: +1 BAB per level, d10, good Fort & Reflex, 4 skill points per level.
Oh, and you get additional animal companions if you stick with Beastmaster, although these will tend to be pretty weak because your "effective druid level" is going to be character level -8 in the best case. They are "free". So you can have that eagle or cute monkey on your arm without feeling like you are wasting your Animal Companion ability. These secondary animals are more for fun and flavor. OTOH even a normal 2 HD Wolf could be trained to open flanks and Aid Other...