In this paper we continue the analysis, started in [6],[7], of the regularity of solutions of free discontinuity problems. We choose as a model problem the minimization of the Mumford-Shah functional. Assuming that in some region the optimal discontinuity set $\Gamma$ is the graph of a $C^{1,\rho}$ function, we look for conditions ensuring the higher regularity of $\Gamma$. Our results are optimal in the two dimensional case. As an application, we prove that in the case of the Mumford-Shah functional and in similar problems the Lavrentiev phenomenon does not occur.