A failure-prone manufacturing system that consists of one machine producing one type of product is studied. The random phenomena examined are machine breakdowns and repairs. We assume that the machine undergoes a progressive deterioration while in operation and that the machine failure rate is a function of its age. The aging of the machine (the dynamics of the machine age) is assumed to be an increasing function of its production rate. Corrective maintenance activities are imperfect and restore the age of the machine to as-bad-as-old conditions. When a failure occurs, the machine can be repaired, and during production, the machine can be replaced, depending on its age. When the replacement action is selected, the machine is replaced by a new and identical one. The decision variables are the production rate and the replacement policy. The objective of this article is to address the simultaneous production and replacement policy optimization problem in the context of manufacturing with deterioration and imperfect repairs satisfying the customer demand and minimizing the total cost, which includes costs associated with inventory, backlog, production, repair and replacement, over an infinite planning horizon. We thoroughly explore the impact of the machine aging on the production and replacement policies. Particular attention is paid to the verification of underlying mathematical results that guarantee the existence of optimal solutions and the convergence of numerical methods. Due to imperfect repairs, the dynamics of the system is affected by the system history, and semi-Markov processes have to be used for modeling. Optimality conditions in the form of the Hamilton–Jacobi–Bellman equations are developed, and numerical methods are used to obtain the optimal control policies (production (rate) and replacement policies). A numerical example is given to illustrate the proposed approach, and an extensive sensitivity analysis is presented to confirm the structure of the obtained control policies.