The aim of this paper is to construct a numerical scheme for solving a class of bilateral free boundaries problem. First, using a shape functional and some regularization terms, an optimal control problem is formulated, in addition, we prove its solution existence's. The first optimality conditions and the shape gradient are computed. the proposed numerical scheme is a genetic algorithm guided conjugate gradient combined with the finite element method, at each mesh regeneration, we perform a mesh refinement in order to avoid any domain singularities. Some numerical examples are shown to demonstrate the validity of the theoretical results, and to prove the robustness of the proposed scheme.