In this article, we propose a novel robust nonlinear optimal second-order sliding mode controller using the homotopy perturbation method (RNOSOSMC-HPM) to maximize wind power capture and minimize the mechanical stress on the drive train. To design the nonlinear optimal controller, the homotopy perturbation method (HPM) is applied to compute the approximate solution of the partial differential Hamilton-Jacobi-Bellman (HJB) equation. Next, the nonlinear optimal controller is combined with a second-order sliding mode controller to create robustness and eliminate chattering. The RNOSOSMC-HPM controller can provide safe wind turbine operation under uncertainties and create a good trade-off between maximizing the wind power captured and attenuating the mechanical loads by minimizing the control input. To investigate the effectiveness of the presented the RNOSOSMC-HPM controller, we compare the results of the proposed method with some existing control schemes in two different scenarios. The results indicate that the RNOSOSMC-HPM controller furnishes desired responses.