The universe is so large distances are measured in billions or millions of light years.
Gravity acts between everything in the universe, but the universe is expanding, so hasn't collapsed.
The expansion was discovered by Hubble, who noticed light appeared redder than it should be. This is red shift.
All galaxies are moving away from each other. They may: slow down and collapse, or expand forever.
The amount of mass in the universe is what will determine what happens.