BERLIN — European officials said Friday that they had brokered a deal between Russia and Ukraine aimed at ensuring gas flows to keep factories running and homes warm over the next six months, despite a dispute over the size of Ukraine’s outstanding bills.

Günther H. Oettinger, the European Union energy commissioner, met Friday in Berlin with the energy ministers of Russia and Ukraine to urge the two sides to reach an agreement that would resume the flow of natural gas from Russia to Ukraine for a set price during the winter. Russia’s natural gas giant, Gazprom, cut off supplies to Ukraine this summer after the two countries failed to reach an agreement on how much Kiev owes Russia for past deliveries.

Under Friday’s deal, which Moscow and Kiev are expected to approve by next week, Ukraine would pay Russia $3.1 billion toward its outstanding bill, in two separate installments by the end of the year. In exchange, Gazprom will ensure that at least 5 billion cubic meters of gas are supplied to Ukraine from October to March at the set price of $385 per 1,000 cubic meters, which must be prepaid before delivery.

Mr. Oettinger said the European Union would guarantee a loan from the International Monetary Fund to help Ukraine meet its debt payments. The deal foresees an initial installment of $2 billion due by the end of October, with the outstanding $1.1 billion due by the end of December.