The effect of gravity extends from each object out into space in all directions, and for an infinite distance. However, the strength of the gravitational force reduces quickly with distance. Humans are never aware of the Sun's gravity pulling them, because the pull is so small at the distance between the Earth and Sun.
Gravity is not a force. It doesn’t have units of force. It has units of acceleration.
Gravity is, therefore, better viewed as an acceleration field. (not terribly different than a magnetic field in many ways).
Two objects of certain mass will generally attract each other (except for Magnets with like poles facing each other when magnetic force > Gravitational force).
Gravitational forces happen whenever there are two or more objects of mass > 0.
Newton's theory of universal gravitation has been proven by Physics to be true. It is called a Theory, not a hypothesis. You learn it in college that The formula is F = (G*M*m)/r^2.
F is the force of gravity (measured in Newtons, N)
G is the gravitational constant of the universe and is always the same number.
M is the mass of one object (measured in kilograms, kg) <usually Earth>
m is the mass of the object attracted (by Earth)
r is the distance between Earth and the object.