We provide a theoretical framework and detailed bioeconomic simulations to examine privately and socially optimal dairy farm management in the presence of nutrient runoff and greenhouse gas emissions. Dairy farms produce milk by choosing herd size, diet, fertilization and land allocation between crops, as well as (discrete) manure storage and spreading technologies and the number of milking seasons. We show analytically that a critical radius emerges for the choice of land use between silage and cereal cultivation and fertilizer types (mineral and manure). Both privately and socially optimal manure application rates decrease with application distance. We characterize the optimal climate and water policy instruments for dairy farming. A detailed bioeconomic simulation model links farm management decisions with their impacts on climate and water quality. We numerically solve the social and private optima and the features of optimal climate and water policy instruments. We show that using only climate instruments provides considerable water co‐benefits, and in the same vein, the use of water quality instruments provides considerable climate co‐benefits. Climate policies lead to a reduction in herd size, as measures relating to manure management and spreading are relatively inefficient at reducing climate emissions. There is much more leeway for adapting to water policies than to climate policies, because dairy farms have multiple measures to reduce their nutrient loads.