This paper presented a preventive maintenance scheduling model to optimize the cost and improve the effective age of machines in complex repairable systems. The objective function of the developed model is to minimize the total maintenance costs while maintaining a defined level of availability and reliability. The maintenance costs include random failure cost, repair cost, replacement cost, and total planned downtime cost. Multilevel preventive maintenance actions such as inspection, repair and replacement are considered through the whole planning horizon. A metaheuristic algorithm like genetic algorithm (GA) was developed using a MATLAB program to provide a near-optimal solution for the optimization model. The proposed mathematical model was applied to a Cathodic Protection System of Gas Distribution Steel Network and the results show a reduction in the total maintenance cost by 36%.