system
Given the following post, respond as if you're commenting on Reddit:
human
Why is gravity not a violation of the second law of thermodynamics?

Note: I come from a chemistry background and this is an astronomy question, so I may be off on some of my assumptions.  

This is a question I've struggled with for a long time and haven't been able to get a clear answer from my previous professors:

The second law of thermodynamics states that the total entropy of a system will increase (or at least not decrease) over time.  From a chemistry perspective this was exemplified by molecules in an isolated system being organized in the most diffuse manner possible.  So if I had 10 particles bouncing around the inside of a box, then doubled the size of the box, over time the particles would on average be farther apart from one another.  This was given as one example of the disorder increasing.

However, the matter of the universe tends to congregate into comets, asteroids, planets, stars, galaxies, local groups, etc.  This is, of course, because matter has mass, and gravity causes mass to be attracted to mass.  So, over time the matter of the universe is collecting into relatively small areas.  To me, this sounds like a decrease in the entropy of the universe.  If entropy was increasing I would imagine that collections of matter would be disintegrating into the void of space to produce the most uniform and diffuse distribution of matter possible.  Why not?  Why isn't gravity a violation of the second law of thermodynamics?

EDIT:  Thank you all for your input.  It seems that the incorrect assumption is that positional entropy is representative of total entropy, which actually includes other factors like the relative heat given off.
gpt
Something similar was asked about attracting magnets recently. The answer is the same: When the things come together due to an attracting force, the potential energy that's equivalent to that force has to go _somewhere_ (First law of thermo!). 

If two asteroids attract each other, they'll accelerate towards each other, and eventually collide. Where does the kinetic energy go? It becomes heat. And _that_ means entropy. So while the entropy is lower strictly in terms of how stuff is dispersed, the _total_ entropy is higher because of the change in temperature.