Taken together, the countries account for nearly half of EU power production - largely thanks to the contributions from Germany and France, Europe's two biggest power producers.
The aim was set by EU members Austria, Belgium, France, Germany, Luxembourg and the Netherlands and non-EU Switzerland, which aligns itself with some EU climate policies.
In a joint statement, the countries said existing EU climate measures are likely to steer Europe towards a nearly CO2-free power sector by 2040.
Agreeing to move faster together, the countries said, would help them jointly plan infrastructure to make sure they build enough grids and energy storage to integrate large amounts of low-carbon power into the network and keep it flowing across country borders.
"The countries have a strongly interconnected electricity system, and can benefit from offshore potential in some areas and storage in other areas," the Netherlands' caretaker energy minister Rob Jetten said.
Overall, the EU got 41% of its electricity from renewable sources in 2022, European Environment Agency data show.
But the CO2 intensity of power generation varies significantly between countries.
For example, Austria already gets more than three quarters of its electricity from renewables, while France relies on CO2 emissions-free nuclear power for around 70% of its power, and Poland has the most CO2-intensive power production of any EU country owing to its high share of coal.
Modelling by think-tank Ember has said it would be possible for all of Europe to nearly decarbonise its power sector by 2035, with wind and solar producing up to 80% of electricity by that date, and coal and gas power largely eliminated.
Doing this would require upfront investments of up to 750 billion euros in renewable sources and grids - but, by 2035, countries would have overall saved money compared with current plans, thanks to a much-reduced bill for fossil fuels, Ember said.