Problem definition: Production systems deteriorate stochastically due to use and may eventually break down, resulting in high maintenance costs at scheduled maintenance moments. This deterioration behavior is affected by the system’s production rate. Although producing at a higher rate generates more revenue, the system may also deteriorate faster. Production should thus be controlled dynamically to tradeoff deterioration and revenue accumulation in between maintenance moments. We study systems for which the relation between production and deterioration is known and the same for each system and systems for which this relation differs from system to system and needs to be learned on-the-fly. The decision problem is to find the optimal production policy given planned maintenance moments (operational) and the optimal interval length between such maintenance moments (tactical). Methodology/results: For systems with a known production-deterioration relation, we cast the operational decision problem as a continuous time Markov decision process and prove that the optimal policy has intuitive monotonic properties. We also present sufficient conditions for the optimality of bang-bang policies, and we partially characterize the structure of the optimal interval length, thereby enabling efficient joint optimization of the operational and tactical decision problem. For systems that exhibit variability in their production-deterioration relations, we propose a Bayesian procedure to learn the unknown deterioration rate under any production policy. Numerical studies indicate that on average across a wide range of settings (i) condition-based production increases profits by 50% compared with static production, (ii) integrating condition-based production and maintenance decisions increases profits by 21% compared with the state-of-the-art sequential approach, and (iii) our Bayesian approach performs close, especially in the bang-bang regime, to an Oracle policy that knows each system’s production-deterioration relation. Managerial implications: Production should be adjusted dynamically based on real-time condition monitoring and the tactical maintenance planning should anticipate and integrate these operational decisions. Our proposed framework assists managers to do so optimally. Funding: This work was supported by the Nederlandse Organisatie voor Wetenschappelijk Onderzoek [Grant 439.17.708]. Supplemental Material: The online appendix is available at https://doi.org/10.1287/msom.2022.0473 .