We present a Bayesian statistical model of diel oxygen dynamics in aquatic ecosystems to simultaneously estimate gross primary production, ecosystem respiration, and oxygen exchange with the atmosphere (and their uncertainties) on the basis of changes in dissolved oxygen concentration, water temperature, irradiance, and, if desired, the O-18 to O-16 ratio (delta O-18-O-2). We test this model using simulated data with realistic measurement errors to demonstrate that it accurately estimates the model parameters and that parameter uncertainties correctly scale with error in the observations and number of data points. Application of the model to field data from two productive stream ecosystems with substantial daily dissolved oxygen variation quantified the underlying physical and biological factors that control oxygen dynamics in these ecosystems and provided empirical support for a light saturation model of the photosynthesis-irradiance relationships at the ecosystem scale. Although inclusion of delta O-18-O-2 provides a second oxygen budget, analysis of field data shows that metabolic and reaeration parameters can be accurately estimated by modeling the transient dynamics of dissolved oxygen concentration alone in relation to daily changes in water temperature and light regime. This model is particularly suited to low-gas exchange, high-productivity systems, which have thus far proved challenging to measure ecosystem metabolism accurately. The modeling framework is applicable to single-station, open-system experimental designs and provides a rigorous and generalizable framework for estimating ecosystem metabolism in aquatic ecosystems.