The tidal effects related to the difference between gravitional field on 2 opposite points of the surface of the earth. 

As the field is proportional to $\frac{M}{r^2}$, the difference is proportional to its derivative $\frac{M}{r^3}$. (Because the earth diameter is small compared to the distance to moon or sun). 

$$F_s \propto \frac{M_{sun}}{r_{sun}^3} $$
$$F_m \propto \frac{M_{moon}}{r_{moon}^3} $$

The relation between that figures is about 0,45. That is: the solar effect on tides of sun is less than half the effect of the moon.

$M = \rho \frac{4}{3}\pi R^3$, where $R$ is the radius of a sphere where the density is being measured. As the density of the moon is bigger than the sun, the tidal effects in the surface of each of those bodies is bigger in the case of the moon.

But in our case of tides on earth, if we apply (for the sun for example):

$$F_s \propto \frac{M_{sun}}{r_{sun}^3} = \frac{\frac{4}{3}\pi \rho_{av} r_{sun}^3}{r_{sun}^3} = \frac{4}{3}\pi \rho_{av}$$

$\rho_{av}$ is not here the density of the sun, but only its mass divided by the volume of a sphere with a radius equal to the distance between sun-earth. (Imagine the sun in its future as a red giant - the effect in our tides doesn't change).

The same can be calculated for the moon. 

That reasoning is only to show the effect of density on tides. It is real, but we must use that modified concept of average density, not the density of the bodies properly.