Updated from 3:13 p.m.

Energy prices in all major categories closed higher Friday as oil futures briefly hit $40 a barrel for the first time since the Gulf War.

The June futures contract ended at $39.93 on the New York Mercantile Exchange, up 56 cents, or 1.4%, after touching exactly $40 earlier in the session. It's the third time in the last four sessions that prices have closed at a near 14-year high -- the highest since October 1990, after Iraq had invaded and occupied Kuwait.

Jan Stuart, vice president of energy research at Fimat USA, said unrest in the Middle East and supply worries that have been driving up oil prices are unlikely to ease any time soon, but said the $40 mark is something of a psychological barrier for some traders.

"You bump up against the ceiling and almost immediately retreat," he said. "The more you don't go through it, the more you agree with these technical specialists, the more you have to wonder and judge if its just a dip and a buying opportunity."

Stuart said he remains bullish about prices but placed little fundamental importance on the $40-a-barrel level.

"Whatever has been driving this rally for the last two or three weeks, I don't see any signs of those elements reversing course," he said.

Gasoline futures also closed higher, gaining 2 cents, or 1.8%, to $1.33 a gallon.

Natural gas prices rose 11.1 cents, or 1.8%, to $6.33 per million British thermal units, bringing the three-month rise to 17%.

A Department of Energy report released Wednesday, said U.S. crude inventories were lower than expected, which factored into the continuing price climb. The report also highlighted gasoline supply worries for the U.S. summer driving season, while security concerns in the Middle East continued unabated.

On Friday, the benchmark European crude, Brent North Sea, closed at a new 14-year high of $37.03, after rising as high as $37.05.

The Organization of Petroleum Exporting Countries has expressed concern about rising oil prices, according to media reports. OPEC will examine the market at a meeting of producing and consuming nations in Amsterdam on May 22 to 24.