This paper proposes the optimal preventive maintenance policy for products under a warranty policy, which combines fully renewable free replacement warranty (FRW) and pro-rata warranty (PRW). Replacement age is divided into three separate periods: within FRW, during PRW and post-warranty. Moreover, it is assumed the product is subject to three types of failures arriving according to a non-homogeneous Poisson process. The first type can be fixed by minimal repair, and the third type is a catastrophic failure that results in product replacement. If the failure is of the second type and the product is at age t, it is either minimally repaired with probability p(t) or replaced by a new one with probability 1−p(t). The aim of this study is to develop the long-run expected cost rate for both warranted and non-warranted repairable products as well as to derive the optimal replacement time such that the incurred costs are minimized. The proposed approach provides valuable information for the product customers, managers, or engineers to make better decisions about the preventive replacement time of such products. The proposed model covers some preventive maintenance policies in the existing literature. Numerical computations are also performed to investigate the effect of the model’s parameters on the optimal solutions. Eventually, a real-life application is discussed to demonstrate the applicability of the proposed policy.