Crude ends up 3.3%, at $49.76 a barrel; first monthly gain since June

Getty Images

Crude snapped a seven month losing streak on Friday, supported by an improving demand outlook and supply outages.

Front-month March New York ultra-low sulfur diesel futures surged more than 7 percent intraday as March ULSD and RBOB rallied ahead of Friday contract expirations.

U.S. April crude settled up $1.59, or 3.3 percent, at $49.76 a barrel. The contract posted a 3 percent gain for the month of February, it's first monthly gain since June.

Read MoreWhy it pays to be cautious on oil

The U.S. crude contract's gains have been hemmed in by rising crude oil inventories in the United States, up 8.4 million barrels last week, according to government data.

Brent April crude was up $3.90 at $62.40 a barrel, on pace to post a 16 percent monthly gain, the first monthly rise since June.

Crude slipping, rig count falls: Hamm
We've cut investment in oil and gas: BASF boss
Looking for oil-induced crash?

Oil has been supported by signs that lower prices are starting to reduce investment in production in non-OPEC countries.

The number of U.S. oil rigs in operation fell again last week, oil services company Baker Hughes reported on Friday. Exploration and production companies took 43 rigs off line, roughly in line with the decrease in the previous week and about half the decline in the three weeks prior to that.

The U.S. count is down 502 rigs from the same time last year, when 1,769 rigs were in operation.

Brent's more pronounced gains this month have been fueled by disruptions to production and exports from Libya and Iraq in recent weeks, contributing to tightness in the physical market in the Mediterranean.

Read More Harold Hamm: Saudis view US oil as economic threat

Also supportive to Brent, Statoil has shut its Statfjord C platform in the North Sea after discovering cracks in the flare tower.

"The main event this week has been the widening of the spread between Brent and WTI (U.S. crude)," Ole Hansen, senior commodity strategist at Saxo Bank, said.

The spread between Brent and U.S. crude widened to $12.80 a barrel on Friday, the highest Brent premium since January 2014.

Brent also received support from strong U.S. refined products futures approaching expiration for March contracts.

"Cold weather and refinery problems and tight supplies on the East Coast have helped make the ULSD contract the most sensitive part of the oil sector," said Robert Yawger, director for energy futures at Mizuho Securities USA in New York.

Read More

March ULSD was up 10.87 cents at $2.2445 a gallon, after reaching $2.3144, a 2015 high and the highest since November.

March ULSD's premium to the April contract was as much as 35.90 cents intraday.

March RBOB gasoline was up 5.44 cents at $1.7620 a gallon, leaving it at a 19 cent deficit to April.

Both products headed for monthly gains.