Gasoline futures for August rose 0.59 cent to settle at $2.2487 a gallon. Earlier in the day, gas futures were off by more than 4 cents a gallon.
August Brent crude futures rose $1.22 to settle at $72.63 a barrel on the ICE Futures exchange in London.
Nymex heating oil futures for August rose 1.94 cents to $2.0618 a gallon, while natural gas prices fell 0.9 cent to settle at $6.764 per 1,000 cubic feet.
Retail gasoline prices extended their decline despite the recent surge in futures prices. The average national price of a gallon of gas fell to $2.957, down 0.4 cent overnight and off 27 cents from its May peak of $3.227, according to AAA and the Oil Price Information Service.
The closure of a 108,000 barrel-per-day refinery in Coffeyville, Kan., due to flooding reignited concerns about the refining industry's ability to keep pace with summer gasoline demand, said John Kilduff, vice president of risk management at Man Financial Inc. The Coffeyville Resources refinery can produce 2.1 million gallons of gasoline per day.
The concern is particularly acute with the nation entering peak summer driving season between the July 4 and Labor Day holidays.