The call, made at the end of three-day talks in Berlin focused on climate change, underscored that the world's major economies were grappling with how to contain inflation and higher energy prices while sticking to environmental goals.
OPEC and its allies, a group known as OPEC+, has so far rebuffed Western calls for a faster increase in oil production to lower surging prices.
"We call on oil and gas producing countries to act in a responsible manner and to respond to tightening international markets, noting that OPEC has a key role to play," said a communique at the end of the G7 talks.
"We will work with them and all partners to ensure stable and sustainable global energy supplies."
Ministers from the G7 group stressed that they would not let the energy crisis derail efforts to fight climate change.
They announced a commitment on Friday to work to phase out coal-powered energy, although failed to set a date for doing so.
The commitment was weaker than a previous draft of the final communique seen by Reuters, which had included a target to end unabated coal power generation by 2030.
Sources familiar with the discussions said Japan and the United States had both indicated they could not support that date. But the pledge still marked the first commitment from the G7 countries to quit coal-fuelled power. Coal is the most CO2-emitting fossil fuel and use of it needs to plummet if the world is to avoid the worst impacts of climate change.
The war in Ukraine has triggered a scramble among some countries to buy more non-Russian fossil fuels and burn coal to cut their reliance on Russian supplies.
"Replacing fossil fuels from Russia has dominated the political debate and the actions of the government in the past weeks and months," German economy minister Robert Habeck said at a news conference.
"But it must be clear to us that the challenges of our political generation, limiting global warming, won't go away if we just concentrate on the present," he said. "Time is literally running out."
The G7 also agreed to largely decarbonise their power sectors by 2035, and to stop public financing for "unabated" fossil fuel projects abroad by the end of this year, except in limited circumstances. "Unabated" refers to power plants that do not use technology to capture their emissions.
The communique made a commitment to a highly decarbonised road sector by 2030, including significantly increasing the sale, share and uptake of zero emission light duty vehicles.
The G7 also aimed to start reporting publicly next year on how the countries are delivering on a past commitment to end "inefficient" fossil fuel subsidies by 2025.
Habeck would not be drawn on which countries had stood in the way of agreeing a date to phase out coal.
"The real question is whether we can make progress compared with the status quo. I would say, even if the 'better' is the enemy of the 'good' - more is always possible - we have taken a step forward with this conference," he said.
Efforts to find alternatives to Russian natural gas supplies had borne fruit, he added.
"But we must be careful not to be too successful. We don't want to build up a natural gas industry over the next 30 or 40 years that we won't want anymore."
The G7 also pledged to take ambitious action against plastic pollution and to increase national efforts to conserve or protect at least 30% of their own coastal and marine areas by 2030.
"In recent months the clouds have indeed darkened over the international landscape. With (Russian President Vladimir) Putin's illegal and brutal invasion of Ukraine, war has unfortunately returned to Europe," said Alok Sharma, Britain's COP26 climate talks president.
"The current crisis should increase, not diminish, our determination to deliver on the challenges that we face on climate, on energy and on the environment."
(Reporting by Kate Abnett in Brussels, Markus Wacket, Maria Sheahan and Kirsti Knolle in Berlin, Yuka Obayashi in Tokyo; writing by Matthias Williams; Editing by Angus MacSwan and David Evans)
By Markus Wacket and Kate Abnett