This paper deals with the problem of the joint determination of the optimal lot sizing and optimal production control policy for an unreliable and imperfect manufacturing system, where the quality control of lots produced is performed using an acceptance sampling plan. The proportion of defective items, the time between failures and the time to repair are generally distributed. The incurred total cost includes manufacturing cost, transportation cost, inspection costs, rejection cost of defective items, replacement cost for returned defective items from customers, and holding and backlog costs. The associated cost minimization problem is formulated with a stochastic dynamic programming model where the lot sizing and production rate are considered as decision variables. Given the difficulties in solving such a highly stochastic model analytically or numerically, we adopted a modified hedging point policy (HPP) to control the production rate, as well as an economic lot sizing policy for batch processing control; we also relied on a simulation-based experimental approach to determine a close approximation of the optimal control parameters. It is shown that production should be accelerated at the maximum production rate, not only when building the safety stock, as in the classical HPP, but also after rejecting a lot, in order to recuperate the loss in inventory and to maintain the on-hand safety stock. Numerical experiments and thorough sensitivity analyses are provided to illustrate the effectiveness of the proposed control policy and the robustness of the resolution approach. Some interesting behaviours regarding the impact of different parameters on the optimal decision variables are observed and discussed.