NEW YORK — Oil prices raced above $145 a barrel for the first time Thursday as traders added to their bets on the commodity ahead of the long holiday weekend.

There was little good news for Americans hitting the road for the July Fourth holiday, as gas prices set their own record near $4.10 a gallon.

Light, sweet crude for August delivery surged $1.72 to settle at a record $145.29 on the New York Mercantile Exchange. Earlier in the trading session, the last of the week, the contract rose to $145.85 a barrel, also a new high.

The gains built on a record-shattering rally the previous day, and left prices 3.6 percent higher for the week. Crude has shot up by more than half just since the start of the year.

Oil has set trading or closing records in each of the last six trading sessions.

U.S. gas prices resumed their march higher as motorists looked ahead to the three-day break. The average retail price for regular gasoline jumped six-tenths of a penny to $4.098 a gallon, according to AAA, the Oil Prices Information Service and Wright Express.

Thursday's surge in oil was propelled by a report of lower crude stockpiles in the United States, lingering concerns about conflict with Iran and comments by Saudi Arabia's oil minister suggesting his country would not boost production.

Prices might have raced even higher Thursday were it not for a sharp gain by the dollar against the euro. The greenback strengthened considerably after the European Central Bank raised interest rates by a quarter point as expected but did not signal additional rate hikes that might further boost the 15-nation euro.

"The strength in crude oil is amazing given the price of the euro," said James Cordier, president of Tampa, Fla.-based trading firms Liberty Trading Group and OptionSellers.com.

A slumping dollar has been a key driver pushing oil prices up by half this year. Many investors buy commodities such as oil as a hedge against inflation when the greenback weakens, and a falling dollar makes oil less expensive to investors overseas. When the dollar strengthens, traders have less incentive to buy commodities.

Oil prices are also rising because investors have been pumping more money into the commodity to compensate for what are perceived to be anemic returns elsewhere, analysts say. The major stock market indexes are all down by double digits since the start of the year.

At the same time, recent saber-rattling in the Middle East has left the markets jittery. And many traders are concerned that there simply is not enough oil in the short term to quench rising global demand — even without a conflict that could disrupt supplies.

"There's a whole lot of thinking right now that prices haven't risen high enough to meet demand growth," Cordier said.

Speaking Thursday in Madrid, Saudi Arabia's oil minister said the world's biggest oil exporter had no immediate plans to boost crude output because there was no need to do so.

Ali Naimi said he was "concerned about the (price) level" and suggested Saudi Arabia is ready to raise production if the kingdom determines supply-and-demand fundamentals have changed. But for now, the minister told reporters, "all our buyers are satisfied and happy."

Soaring fuel costs are squeezing cash-strapped drivers and inflating prices in the U.S., the world's leading oil consumer. Last Fourth of July, drivers were paying just $2.95 a gallon for gas — about $1.15 less than today.

The government issued more troubling economic news Thursday, reporting that U.S. employers cut payrolls by 62,000 in June, the sixth straight month of nationwide job losses.

But because the jobs report was largely in line with what analysts expected, it "had little-to-no impact" on oil prices, said Addison Armstrong, director of market research at Tradition Energy.

Traders were also keeping an eye on storms brewing offshore.

A system developing near the Cape Verde Islands off the western coast of Africa was upgraded to become the second tropical storm of the hurricane season, although it was expected to turn northward and avoid the oil and natural gas platforms scattered throughout the Gulf of Mexico.

"It's more of a psychological thing," Cordier said. "It reminds traders that hurricane season is ahead of us, not behind us."

In other Nymex trading, heating oil futures rose 3.45 cents to settle at $4.106 a gallon, while gasoline futures added 2.16 cents to settle at $3.571 a gallon. Natural gas futures jumped 18.8 cents to settle at $13.584 per 1,000 cubic feet.

In London, Brent crude futures rose to a trading record of $146.69 a barrel on the ICE Futures exchange before settling at $146.08, up $1.82.