Get your ratchet as close to the bolt as possible. Using an overly long extension just causes more torsion on the extension possibly stripping the head due to slipping
Word of advice; don't use the ratchet to initially break the bolts free. You can potentially damage the internal mechanism. Always use a breaker bar. They're tough enough to deliver the initial high torque required to free the bolt. Then use the ratchet to speed up the loosening process.