I think the correlation between testicle size and promiscuity is probably due to the simple "selfish gene" explanation, but I agree that sex can play an important part in social cohesion. This is especially important in bonobos of course. (Where humans might shake hands - bonobos have sex.)
The reason that chimp behaviour is so different to gorilla behaviour is probably because of the food they eat. Gorillas eat large volumes of food of relatively low nutritional value like roots and tubers, so they can afford to be slow moving and they can live in small inoffensive family groups wandering around to find what food they can.
Chimps often share the same parts of the forest with gorillas but they eat small amounts of high value food like fruit, and they occasionally hunt meat, so they have to be quick and clever to make sure they get the best of the food. They live in bigger more flexible groups that are more competitive. The males have to hunt co-operatively so it follows that they live in mixed fission/fusion groups within larger communities - hence the promiscuity.
Bonobos live in areas where there are no gorillas so they can find both kinds of food. So, it is thought that, because they don't need to compete for food in such a competitive way, that this is the reason that they are much more gentle and inoffensive than chimps.
This seems to be the theory. Makes sense to me anyway.