Combined heat and power (CHP) generation is often used when building new district heating production. CHP makes it possible to simultaneously produce electricity and heat, thus maximizing the energy efficiency of the primary fuel. The heat is used in the connected district heating system while the electricity is sold on the local power market. In a CHP plant it is not possible to separate the physical process of producing heat and electricity, which may cause suboptimal behaviour when high spot prices for power do not coincide with high heat load demand. This paper presents the design and implementation of a system which makes it possible to control the heat load demand in a district heating network in order to optimize the CHP production. By using artificial intelligence technology in order to automate the run‐time coordination of the thermal inertia in a large amount of buildings, it is possible to achieve the same operational benefits as using a large storage tank, albeit at a substantially less investment and operational cost. The system continuously considers the climate in each participating building in order to dynamically ensure that only the best suited buildings at any given time are actively participating in load control. Based on the dynamic indoor climate in each individual building the system automatically controls and coordinates the charging and discharging of the buildings thermal buffer without affecting the quality of service. This paper describes the overall function of the system and presents an algorithm for coordinating the thermal buffer of a large amount of buildings in relation to heat load demand and spot price projections. Operational data from a small district heating system in Sweden is used in order to evaluate the financial and environmental impact of using this technology. The results show substantial benefits of performing such load control during times of high spot price volatility.