This research investigates the case of an unreliable manufacturing system subject to quality and reliability deterioration. In particular, we conjecture that the deterioration of the system leads to a continuous increase in the intensity of failures and a decrease on the quality of the parts produced. As such, deterioration implies a twofold effect on the manufacturing system. When the machine fails, minimal repair is conducted, leaving the machine at the same level of deterioration before failure. Hence, the quality of the parts produced and the failure intensity remain unchanged with this repair. Meanwhile, an overhaul refers to a perfect repair that completely restores the quality of the parts and the failure intensity of the machine. This option completely counters all the effects of the deterioration. Preventive maintenance may also be conducted, but it reduces the level of deterioration only partially, improving the quality of the units produced and the failure intensity just in part. These set of characteristics yield to the formulation of a new control model that simultaneously determines the optimal production plan, the overhaul and preventive maintenance strategies. Such a joint control policy minimizes the total cost including the inventory holding, backlog, overhaul, preventive maintenance and defectives costs over an infinite planning horizon. Since the dynamics of the system change as a function of the level of deterioration, it is necessary to use its history for a proper formulation; therefore a Semi-Markov decision process is used. Numerical methods are applied to determine the control policy and numerical examples are conducted as illustrations. An extensive sensitivity analysis is presented in order to confirm the structure of the control policy obtained and examine the effect of several parameters.