Because of their limited spatial resolution, numerical weather prediction and climate models have to rely on parameterizations to represent atmospheric turbulence and convection. Historically, largely independent approaches have been used to represent boundary layer turbulence and convection, neglecting important interactions at the subgrid scale. Here we build on an eddy-diffusivity mass-flux (EDMF) scheme that represents all subgrid-scale mixing in a unified manner, partitioning subgrid-scale fluctuations into contributions from local diffusive mixing and coherent advective structures and allowing them to interact within a single framework. The EDMF scheme requires closures for the interaction between the turbulent environment and the plumes and for local mixing. A second-order equation for turbulence kinetic energy (TKE) provides one ingredient for the diffusive local mixing closure, leaving a mixing length to be parameterized. Here, we propose a new mixing length formulation, based on constraints derived from the TKE balance. It expresses local mixing in terms of the same physical processes in all regimes of boundary layer flow. The formulation is tested at a range of resolutions and across a wide range of boundary layer regimes, including a stably stratified boundary layer, a stratocumulus-topped marine boundary layer, and dry convection. Comparison with large eddy simulations (LES) shows that the EDMF scheme with this diffusive mixing parameterization accurately captures the structure of the boundary layer and clouds in all cases considered. Plain Language Summary Turbulence and convection transport heat and moisture in the atmosphere and are ultimately responsible for the formation of clouds. However, they act on scales far too small to be resolved in current global atmosphere models. Instead, parameterizations have to be used to approximate their average effect on the finite volumes that are resolved in a global model. These parameterizations are often tailored to specific atmospheric conditions and fail when those conditions are not met. Here we propose a parameterization that aims to reproduce the average effect of turbulent heat and moisture transport under all atmospheric conditions. Numerical simulations demonstrate the accuracy of the parameterization in simulating turbulence in atmospheric boundary layers under stable and convective conditions, including the simulation of stratocumulus clouds.