U.S. energy firms added oil rigs for a third week in a row for the first time since June, keeping the rig count at its highest in over three years, as declining productivity in some shale fields force companies to drill more to keep output growing.

Drillers added two oil rigs in the week to Oct. 26, bringing the total count to 875, the highest level since March 2015, Baker Hughes, a GE company (NYSE: BHGE), said in its weekly report.

For the month, the rig count rose 12 in October, the biggest monthly increase since drillers added 34 rigs in May. That was also the first time the count increased for four months in a row since July 2017, but the increases from July through to September where marginal as new drilling largely stalled due to pipeline constraints in the Permian Basin.

More than half the total U.S. oil rigs are in the Permian Basin in West Texas and eastern New Mexico, the country’s biggest shale oil formation. Active units there decreased by one this week to 489. Last week, the Permian count rose to its highest since January 2015.

The U.S. rig count, an early indicator of future output, is higher than a year ago when 737 rigs were active because energy companies have ramped up production to capture prices that are higher in 2018 than 2017.

On Oct. 26, U.S. crude futures were trading around $67.60 per barrel, putting the contract on track to fall for a third week in a row after Saudi Arabia warned of oversupply despite upcoming Iran sanctions due to begin on Nov. 4.

So far this year, U.S. oil futures have averaged $67.24 per barrel. That compares with averages of $50.85 in calendar 2017 and $43.47 in 2016.

Data from the U.S. government shows output from new wells in the Permian has mostly declined over the past couple of years.

New oil well production per rig in the Permian reached a high of 759 barrels per day (bbl/d) in August 2016. Since then, that new well output was expected to decline to just 595 bbl/d in November, according to the U.S. Energy Information Administration’s (EIA) productivity report last week.

That means energy firms must drill more wells just to get the same amount of oil out of the ground.

Even though the number of wells drilled last month in the Permian rose to its highest since December 2014, completions are not keeping up, causing the number of wells drilled but uncompleted (DUCs) in the basin to rise to a record high.

Technical challenges could slow growth shale oil production in the next 12 to 18 months, the CEO Schlumberger NV (NYSE: SLB), the world’s largest oilfield services provider, said Oct. 23.

U.S. financial services firm Cowen & Co. this week said E&P companies it tracks have provided guidance indicating a 19% increase this year in planned capital spending.

Cowen said the E&Ps it tracks expect to spend a total of $85.7 billion in 2018. That compares with projected spending of $72.2 billion in 2017.

Analysts at Simmons & Co., energy specialists at U.S. investment bank Piper Jaffray, this week forecast the average combined oil and natural gas rig count would rise from 876 in 2017 to 1,031 in 2018, 1,092 in 2019 and 1,227 in 2020.

Since 1,068 oil and gas rigs are already in service, drillers do not have to add any rigs for the rest of the year to hit Simmons’ forecast for 2018.

Year-to-date, the total number of oil and gas rigs active in the United States has averaged 1,023. That keeps the total count for 2018 on track to be the highest since 2014, which averaged 1,862 rigs. Most rigs produce oil and gas.