US energy companies this week added the most oil rigs since July 2015, extending the seven-month drilling recovery as crude prices rose to a near 17-month high.

Drillers added 21 oil units in the week to 9 December, bringing the total oil rig count up to 498, the most since January, but still below the 524 rigs seen a year ago, energy services firm Baker Hughes said on Friday.

Drillers also added six gas units, bringing the active natural gas rig count to 125.

Texas saw the biggest gains, adding 17 rigs for 303. It saw the biggest growth in the Permian basin, which added 11 rigs.

New Mexico, which is home to the western part of the Permian, also added one rig for a total of 30.

Elsewhere in Texas, the Eagle Ford shale added three rigs while the Barnett shale lost one.

The Granite Wash play, which straddles the Texas-Oklahoma border, added two rigs.

However, Oklahoma lost one rig overall, as its Cana Woodford play shed two rigs. Oklahoma's total rig count stands at 80.

Colorado added six rigs for 26. Its gains were mirrored in the DJ-Niobrara play, which also added six rigs.

Pennsylvania picked up two rigs for 31. The addition was reflected in the state's Marcellus shale play, which also gained two.

Wyoming added three rigs for 20.

The Williston basin of North Dakota, home of the Bakken shale play, added one rig for 32.

Arkansas and Kansas each gained one rig for respective totals of two and one.

Alaska and Louisiana each lost one rig for respective totals of six and 47.

Canada added 30 rigs for a total of 230.

Since crude prices briefly recovered from 13-year lows to around $50 a barrel in May, drillers have added a total of 182 oil rigs in 25 of the past 28 weeks, its biggest recovery since a global oil glut crushed the market over two years.

The Baker Hughes oil rig count plunged from a record 1609 in October 2014 to a six-year low of 316 in May as US crude collapsed from over $107 a barrel in June 2014 to near $26 in February 2016.

US crude futures were trading around $51 a barrel on Friday on optimism that non-Opec producers meeting in Vienna over the weekend would agree to cut output to bolster the cartel's own agreement to limit production.

Opec last week agreed to slash production by 1.2 million barrels per day in the first half of 2017.

With prices expected to keep rising in coming months, analysts said they expect US energy firms to boost spending on drilling and pump more oil and natural gas from shale fields in coming years.

Futures for calendar 2017 were trading around $54 a barrel, while calendar 2018 was fetching near $55.

Analysts at Simmons, energy specialists at US investment bank Piper Jaffray, forecast the total oil and gas rig count would average 506 in 2016, 699 in 2017 and 910 in 2018.

That compares with an average of 978 oil and gas rigs active in 2015 and an average of 498 so far in 2016, according to Baker Hughes data.

Analysts at US financial services firm Cowen said in a note this week that its capital expenditure tracking showed 20 exploration and production (E&P) companies, including PDC Energy, planned to increase spending by an average of 34% in 2017 over 2016.

That projected 2017 spending increase followed an estimated 48% decline in 2016 and a 35% decline in 2015, Cowen said according to the 64 E&P companies it tracks.