U.S. energy firms this week added oil and natural gas rigs for a sixth week in a row in the best quarter for boosting the rig count since the second quarter of 2017 as producers return to the wellpad with crude prices holding above $45/bbl.

The oil and gas rig count, an early indicator of future output, rose 3 to 351 in the week to Dec. 30, energy services firm Baker Hughes Co. said in its closely followed report.

During December, the total rig count rose by 31, its fifth monthly increase in a row.

For the quarter, the count was up 90, the most in a quarter since the second quarter of 2017 when it rose by 116 rigs.

For the year the count was down 454. That compares with a decrease of 278 rigs in 2019 and an increase of 154 rigs in 2018.

The number of operating rigs has surged since August, when it hit a record low of 244, according to Baker Hughes data going back to 1940.

Baker Hughes released its North American rig count report two days earlier than usual due to the New Year holiday.

U.S. oil rigs rose to 267 this week, their highest since May, while gas rigs remain unchanged at 83, their highest since the end of April, according to Baker Hughes data.

U.S. crude traded around $48/bbl this week and has averaged about $39/bbl so far in 2020.

Even though the oil contract was down about 20% since the start of the year, it was still up about 160% over the past eight months on hopes global economies and energy demand will return as more governments relax coronavirus lockdowns.

Analysts said those higher oil prices have encouraged several energy firms to drill more.

Looking forward, most energy firms have said they plan to cut spending in 2021 as they stay focused on improving earnings rather than just boosting output.

Year-to-date, the total number of oil and gas rigs active in the U.S. has averaged 433. Most rigs produce both oil and gas.