With more and more wind farms integrated into the power grid, the stability and security of the grid can be significantly affected by the wind-farm-generated power, due to the intermittent and volatile nature of the wind-farm-generated power. Therefore, control of the wind-farm power to meet the stability and quality requirements becomes important. Active control of wind-farm power, however, is challenging because the wind-farm output power can only be reliably predicted for a short period of time (i.e., ultrashort term power prediction), and large variations exist in the wind-turbine output power. In this paper, an optimal active power control scheme is proposed to maximize the running time of each wind turbine, and minimize the on-and/or-off switching of wind turbines, resulting in substantial reduction of wind-turbine wear and thereby, maintenance cost, and extension of wind-turbine lifetime, all together, a significant saving of operation cost of the whole wind farm. The proposed approach is illustrated by implementing it to the active power allocation of a wind-farm model in simulation.