Take the Sun as a point object at the origin.
Take the Earth as a sphere centred at $x=d$ with a radius of $R$
Let $d=150,000,000,000$ m
Let $R=6,400,000$ m
Slice the sphere into vertical disks of mass $\Delta m$
The force on each disk will be $\frac{k\Delta m}{x^2}$ where $k=GM_{Sun}$
The total force will be $F=k\int^{d+R}_{d-R} \frac{\Delta m}{x^2}$
Assume the Earth has a constant density.
Let the mass of the entire Earth be $m$
$$\frac{\Delta m}{volume-of-disk}=\frac{m}{volume-of-earth}$$
$$\frac{\Delta m}{\pi y^2 \Delta x}=\frac{m}{\frac{4}{3}\pi R^3}$$
$$\Delta m = \frac{3my^2}{4R^3} \Delta x$$
$$F=\frac{3km}{4R^3}\int^{d+R}_{d-R} \frac{y^2}{x^2} \delta x$$
Let's deal with the $y^2$ now.
$$R^2=y^2+(d-x)^2$$
$$y^2=R^2-d^2+2dx-x^2$$
$$\frac{y^2}{x^2}=\frac{R^2-d^2}{x^2}+\frac{2d}{x}-1$$
So the force is now: $$F=\frac{3km}{4R^3}\int^{d+R}_{d-R} (\frac{R^2-d^2}{x^2}+\frac{2d}{x}-1) \delta x$$
$$F=\frac{3km}{4R^3} [\frac{d^2-R^2}{x}+2d \ln{|x|}-x]^{d+R}_{d-R}$$
$$F=\frac{3km}{2R^3}(d\ln{|\frac{d+R}{d-R}|}-2R)$$
If the force of gravity is acting on a point at location $x=r$ then the force $F$ is also given by: $$F=\frac{km}{r^2}$$
So:
$$F=\frac{km}{r^2}=\frac{3km}{2R^3}(d\ln{|\frac{d+R}{d-R}|}-2R)$$
$$F=\frac{1}{r^2}=\frac{3}{2R^3}(d\ln{|\frac{d+R}{d-R}|}-2R)$$
Now when I sub in $R=6400000$ and $d=150000000000$ I expect to get a value for $r$ slightly less than $d$ , but I don't get this result. In fact the value of what is in the bracket turns out to be negative: $-0.003868$. Have I done something wrong in my derivation ?