When we are to calculate the moment of inertial of an object, we basically sum all the infinitesimal moments of inertial of all small elements, so since $m_i /V_i = \sigma$ where $\sigma$ is the density of that small element, which will be constant for the time being.Therefore
$$dm r^2 = \sigma dVr^2$$.For an sphere, $dV = r^2 sin(\phi) dr d\phi d\theta$, and hence
$$I = \frac{\int_0^{2\pi} \int_0^\pi \int_0^R \sigma r^4 sin(\phi) dr d\phi d\theta}{\int_0^{2\pi} \int_0^\pi \int_0^R r^2 sin(\phi) dr d\phi d\theta}$$
But after calculation these integrals, I get
$$I = \frac{3MR^2}{5}$$.
I check many times that there is no problem in the calculation, but I can not find the problem in the construction since every source that I looked says that
$$I = \frac{2MR^2}{5}$$.
In order to find the moment of inertia of a solid sphere with respect to the $z$-axis you should integrate: $$I = \iiint_B (x^2+y^2) (\sigma dV)=M\frac{\iiint_B (x^2+y^2) dV}{\iiint_B dV}\\ =M\frac{\int_0^{2\pi} \int_0^\pi \int_0^R (r \sin(\phi))^2\cdot r^2\sin(\phi) dr d\phi d\theta}{\int_0^{2\pi} \int_0^\pi \int_0^R r^2 \sin(\phi) dr d\phi d\theta}=\frac{2MR^2}{5}.$$