The U.S. oil drilling rig count declined this week for the first time in four weeks, although the rig count held close to its highest in over three years as production surges to record highs and some companies forecast even higher output this year.

Drillers cut one oil rig in the week to Nov. 2, bringing the total count down to 874, Baker Hughes, a GE company, said in its weekly report.

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

More than half the total U.S. oil rigs are in the Permian Basin, the country’s biggest shale oil formation. Active units there decreased by two this week to 487 this week.

U.S. crude oil production surged by 416,000 barrels per day (bbl/d) to a record 11.346 million bbl/d in August, the government said in a monthly report on Oct. 31, as production in Texas and North Dakota climbed to fresh peaks.

Apache Corp. reported a better-than-expected quarterly profit and raised its production forecast for the year as it benefited from rising oil prices and increased output from the Permian.

Top Bakken producer Continental Resources Inc. on Oct. 29 said its output from the oil-rich North Dakota shale field hit a record during the third quarter and would increase significantly through the end of the year as it completed more wells.

Apache and its peers are reaping the benefit of a 32% surge in average U.S. crude oil prices from a year earlier. So far this year, U.S. oil futures have averaged $67.19 per barrel, up from $50.85 in 2017 and $43.47 in 2016.

On Nov. 2, U.S. crude futures were trading around $63 per barrel, putting the contract on track to fall for a fourth week in a row on demand concerns despite upcoming U.S. sanctions on Iran due to begin on Nov. 4.

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

Cowen said the E&Ps it tracks expect to spend a total of $86.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,067 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,024. That keeps the total count for 2018 on track to be the highest since 2014, which averaged 1,862 rigs. Most rigs produce both oil and gas.