Does gravity cause Archimedes' principle and how? Why do lighter objects float and denser sink? I understand this from the perspective that if the object can displace the equal mass of water it will float, but I wonder from the perspective of gravity! How does gravity cause Archimedes' principle? It must be gravity, right, because in space Archimedes' principle doesn't work!
The ultimate question I need to answer is how all this force interplay causes density stratification. For example, how does gravity cause Earth to have a density gradient: the densest elements in the core, and the lightest in the crust?

Here's what I got from the comments so far. I though it should be a good starting point if someone wants to write an answer. It also can be totally wrong.
There is a pressure gradient inside a body of liquid along the depth gradient. It is caused by the fact that the distance between two objects is squared and inversely proportional to the gravitational pull (see the image below). The deeper water thus is attracted to the Earth stronger, and where there is a pressure difference, there is a force, the buoyant force in this case.
However, now I have even more questions than I used to:


*

*If there is a pressure gradient, why there's no flow in water along the depth gradient?

*What mechanism (or what part of the gravity equation) makes denser objects sink despite the buoyant force? Is it the mass? What about Galileo's experiment then? Doesn't it show that the effect of mass is negligible?



 A: The deeper you are under water the higher pressure. This is because the deeper you are the more water is above you. And water is pushing downwards due to gravity, thus more water above you means more push and hence more pressure.
Please note that deep under water the pressure is not caused by higher gravity. The gravity at depth is in fact lower than on the surface. The only cause of water pressure is the weight of the water above.
Objects under water occupy certain space and they have certain non-zero height. There is a pressure difference between the top and the bottom part of the object. This is causing a difference in the pressure force pushing on the object from above and from below: the force from below is bigger because of the weight of the water above. The difference is enough to overcome the weight of the object, if the object is less dense than water. In other words, if the object weights less than water of the same volume.
A: 
How does gravity cause Archimede's principle?

Well the Archimede's principle says that the buoyancy force $F_g$ of an object of volume $V$ dipped in a liquid with density $\rho_f$ equals to:
$$F_g=\rho_f Vg$$
Now if the weight of the body is stronger than the buoyancy force then the object will fall deep in the water, if the weight is equal the object will be immersed and will float if the weight is less than the buoyancy force.
Now we can set the equations and the inequalities:
$$mg=\rho_f Vg\quad mg>\rho_fVg\quad  mg<\rho_f Vg$$ 
BUT we know that $\rho=\frac{m}{V}$ and so $m=V\rho$
$$V\rho g=\rho_f Vg\quad V\rho g>\rho_fVg\quad  V\rho g<\rho_f Vg$$ 
$$\rho=\rho_f \quad \rho >\rho_f \quad  \rho <\rho_f$$ 
that are the condition for floatation ONLY IF the object immersed in the liquid "has" weight.
A: 
  
*
  
*If there is a pressure gradient, why there's no flow in water along the depth gradient?
  

There is actually a flow. The exchange of water between the upper and lower parts of a lake, for instance, is just slow.

  
*
  
*What mechanism (or what part of the gravity equation) makes denser objects sink despite the buoyant force? Is it the mass? What about Galileo's experiment then? Doesn't it show that the effect of mass is negligible?
  

The Galileo's experiment shows that the velocity of the falling objects is the same. However the force ($F=mg$) the falling objects exert depends on their mass (and therefore density). Simply throw a 0,1 kg ball and a 10 kg ball out of your window and see the marks they left on your lawn.
That's why denser objects sink deeper: the pressure (force/area) they exert is greater.
A: Write down the energy of the system as a function of the location of the object in the container of water (keep it simple, a finite small sphere in a vertical cylinder of fluid). To do this, one must keep track of where H20 and the sphere material are in space -- and do the mgh calculation for every voxel of material. Eventually you will have an expression for the potential energy of the system (static case) for the height x of the object center in the cylinder. I think you will quickly see that for an object denser than water, the energy of the system is LOWER if the object resides at the bottom of the cylinder -- and for an object less dense than water, the lower overall energy configuration corresponds to the floating object (top of cylinder). In other words, depending on the density of the submerged object there is an energy GRADIENT along h (length variable that gives the system configuration). Recall that spatial energy gradients correspond to FORCES. Depending on the density of the immersed sphere, the energy density points up or down (or nowhere is the sphere has the density of water).
For the more sophisticated physics student, write down the Lagrangian for the system ignoring kinetic energy of the sphere or water flowing around it (so all energy is potential; this is same as above but now explicitly part of the framework of Action). Euler-Lagrange yields the desired result.
I suppose another approach would be to consider the differential P on the surface of the immersed sphere -- the net force related to P integrated on the surface opposes (or assists) weight, and the same result is obtained. This approach gets sticky for the limiting case of a very small sphere for which the P force is nearly zero (as is the weight) -- but done carefully, I suspect the result holds down to the infinitesimals.
I like the spatial gradient of energy perspective since it avoids conjuring forces altogether and one can view the problem from the action. Lots of problems in mechanics are best analyzed in this fashion.
(The inverse square/tidal force approach is a non-starter. Archimedes' Effect holds in a constant g field).
