Determination of optimal production lot size has been always noticed by researchers and various models have been proposed in this area. Among the subjects, which has been less considered in these models is machine failure. Obviously, a machine may encounter random failures during its working period and this makes clear the need for applying an appropriate maintenance policy for the machinery. In this paper based on assumptions such as authorized shortage, work in process inventory and possibility of producing defective products with and without the ability to re-work, EPQ model has been investigated and developed to select Preventive Maintenance (PM) policy for the machinery. In addition, by minimizing system’s total cost over a period of time, a formula has been presented for determining optimal production lot size and its application has been examined using various numerical examples.