The Rate of Penetration (ROP) is one of the key parameters related to the efficiency of the drilling process. Within the confines of operational limits, the drilling parameters affecting the ROP should be optimized to drill more efficiently and safely, to reduce the overall cost of constructing the well. In this study, a data-driven optimization method called Extremum Seeking is employed to automatically find and maintain the optimal Weight on Bit (WOB) which maximizes the ROP. To avoid violation of constraints, the algorithm is adjusted with a combination of a predictive and a reactive approach. This method of constraint handling is demonstrated for a maximal limit imposed on the surface torque, but the method is generic and can be applied on various drilling parameters. The proposed optimization scheme has been tested on a high-fidelity drilling simulator. The simulated scenarios show the method’s ability to steer the system to the optimum and to handle constraints and noisy data.