The full mathematical statement is as follows:
Theorem
If two particles exert a mutual conservative force $\mathbf{F}_{12}$ and $\mathbf{F}_{21}$ which is independent of any other degree of freedom of any bigger system they're part of, and obeys Newton's third law as $\mathbf{F}_{12}+\mathbf{F}_{21}=\mathbf{0}$, with the forces collinear to the particles' relative orientation, then this mutual force can be written in the form
$$\mathbf{F}_{ij}=-\nabla_j V(|\mathbf{r}_1-\mathbf{r}_2|)$$
for some appropriate potential $V$.
It is important to assume that the force is independent of any degrees of freedom other than the particles' DOFs. This is quite natural, as otherwise it would be very difficult to interpret the force as one caused by one particle on another.
Under this assumption, the requirement that the force be conservative requires the existence of some potential $V$, which depends only on $\mathbf{r}_1$ and $\mathbf{r}_2$, such that
$$\mathbf{F}_{ij}=-\nabla_j V(\mathbf{r}_1,\mathbf{r}_2).$$
This function can be transformed, without losing any information, into a function of the relative position $\mathbf{r}=\mathbf{r}_1-\mathbf{r}_2$ and some sort of "mean" position, say the average $\mathbf{R}=\tfrac12\mathbf{r}_1+\tfrac12\mathbf{r}_2$, though any linear combination (e.g. COM position) independent to $\mathbf{r}$ is acceptable. Under this change of variables, the gradients transform as
$$
\left\{\begin{array}{}
\nabla_{\mathbf{r}_1}=\phantom- \nabla_{\mathbf{r}}+\frac12\nabla_{\mathbf{R}},\\
\nabla_{\mathbf{r}_2}=-\nabla_{\mathbf{r}}+\frac12\nabla_{\mathbf{R}},
\end{array}\right.
$$
so that the statement of Newton's third law in this setting becomes
$$
\mathbf{0}
=\nabla_{\mathbf{r}_1}V(\mathbf{r},\mathbf{R})+\nabla_{\mathbf{r}_2}V(\mathbf{r},\mathbf{R})
=\nabla_{\mathbf{R}}V(\mathbf{r},\mathbf{R}).
$$
There is thus no dependence on the absolute position $\mathbf{R}$, and the force can be written as
$$\mathbf{F}_{ij}=-\nabla_j V(\mathbf{r}).$$
For the final step, as QMechanic pointed out, you use the fact that the force is collinear to the relative orientations. If $V$ depends on the angular variables of $\mathbf{r}$, then its gradient will not be purely radial. If you require a formal proof, note that forcing the non-radial components of the gradient in spherical coordinates,
$$
\nabla f
=\frac{\partial f}{\partial r}\hat{{r}}
+\frac1r\frac{\partial f}{\partial \theta}\hat{{\theta}}
+\frac{1}{r\sin\theta}\frac{\partial f}{\partial r}\hat{{\phi}},
$$
to vanish, requires the partial derivatives with respect to $\theta$ and $\phi$ to vanish; there is thus only a dependence in $r$.
With this, then, you have your final result: the force can be written as
$$\mathbf{F}_{ij}=-\nabla_j V(|\mathbf{r}_1-\mathbf{r}_2|).$$