An optimal control approach for a wind turbine drivetrain with a variable ratio gearbox is presented. The objective is to find the optimum shifting sequence of the variable ratio gearbox in order to maximize power generation and extend gear life. The employment of a variable ratio gearbox enhances the capabilities of the wind turbine to cope with wind speed variations. Based on the authors' preliminary study, the gear ratios of the variable ratio gearbox were carefully selected to maximize the wind energy capture. In this paper, a new control approach is proposed to achieve both extended gear service life and optimal energy harvesting. This new approach finds the gear shifting sequence that will minimize the tangential force on the gear tooth while maximizing the wind energy capture. The wind turbine drivetrain with a variable ratio gearbox is modeled and simulation results based on recorded wind data of different wind classes are presented and compared.