We apply Robin penalization to Dirichlet optimal control problemsgoverned by semilinear elliptic equations. Error estimates in terms of the penalization parameter are stated. The results are compared with some previous ones in the literature and are checked by a numerical experiment. A detailed study of the regularity of the solutions of the PDEs is carried out.