Local energy generation and energy use flexibility is becoming increasingly relevant for planning energy systems with a high level of renewables, electrification, and decentralization. Although current energy system models represent various flexibility options, capturing demand-side flexibility and prosumption remains challenging. In light of these challenges, this study presents a national-scale energy system optimization model covering the residential and commercial sectors of Belgium and considering the interplay between local energy use flexibility from electric vehicle (EV) charging, battery storage, rooftop photovoltaic (PV) systems and distribution grids. To adequately represent energy use flexibility, the model adopts a high temporal resolution, consisting of three representative weeks at an hourly time scale. The role of prosumption is analysed by introducing a prosumer potential reflecting the extent to which local energy production can be used to meet local demand ‘behind the meter’. The results show that flexibility significantly reduces total system costs with reduced distribution grid capacity investment by 48% by 2050. Furthermore, local energy use flexibility enables a significant uptake of rooftop PV (+6.7 GW), but only under a high prosumer potential condition. Finally, a curtailment of around 5–7% of PV production is cost-effective to sustain a more continuous use of the distribution grid at low peak capacity. To increase the robustness of the results, future research should consider expanding the model's sector coverage, adding additional flexibility sources, improving the representation of prosumption, soft-linking with distribution grid models and a better representation of mobility patterns.