Why is that? It’s gravity has prevented the Sun from pulling us (along w/Merc, Ven, Mars) into it?
If that’s what you mean, I never thought about that but it makes sense.
No, it's because Jupiter, with its strong gravitational field, over a long period of time, has sucked in many passing comets and asteroids that might otherwise have crashed into Earth.