From the Wikipedia article on solar sails:
The force on a sail and the actual acceleration of the craft vary by the inverse square of distance from the Sun (unless extremely close to the Sun)
This is when you are accelerating straight away from the Sun, and "proportional to inverse square of distance" is $\frac{1}{r^2}$.
The problem is that this is only valid when you are far from the Sun, and can model it as a point source of light.
Of course the Sun is not a point, and its radius is important when close to it. After a little thinking, I came up with this modification to the proportionality law:
$$\frac{2}{3}\left(1-\cos^3\left(\sin^{-1}\left(\frac{r_S}{r}\right)\right)\right)$$
Or, if you prefer it non-trig:
$$\frac{2}{3}\left(1-\sqrt{\left(1-\left(\frac{r_S}{r}\right)^2\right)^3}\right)$$
Where $r$ is the distance from the centre of the Sun and $r_S$ is the radius of the Sun. This follows the $\frac{1}{r^2}$ law at a distance, but accounts for the fact that some of the light hits the sail at an angle when it is close to the Sun, following the squared cosine rule.
I have not been able to find a modified relation anywhere, but is this correct? Also, is there a way to include the diameter of the Sun in a formula taking the orientation of the sail into account? That seems difficult, as light is hitting both sides of the sail.
For a visualisation of the difference, this plots the simple proportionality in red, and the modified in grey. Distance from the middle of the Sun along the x-axis, and proportionality along the y-axis.