Pennsylvania lawmakers passed a bill to rewrite state laws governing natural-gas drilling, capping a multiyear debate within the state about how to responsibly drill for natural gas in the Marcellus Shale formation.

Gov. Tom Corbett, who pushed for the legislation, praised its passage by the Republican-led House on Wednesday after a debate that stretched over two days as Democrats often angrily opposed the bill.

“This legislation reaffirms our strong commitment to safe and responsible natural-gas development here in Pennsylvania,” said Mr. Corbett. He said the bill would help create jobs, enhance environmental protection and move the state toward energy independence.

The Pennsylvania House passed the bill 101-90, mostly along party lines, as did the Senate on Tuesday.

House Democrats argued the bill sets drilling fees too low compared with other states, goes too far in limiting the ability of local governments to zone for gas development and is too weak on environmental protections.

“This bill does not make drillers pay their share to adequately protect our land and water,” said Democratic House Minority Leader Frank Dermody. “Once again, Pennsylvania’s taxpayers will be left holding the bag.”

Under the bill, drilling fees will rise and fall with the price of natural gas and inflation, with a minimum of $190,000 a well and a maximum of $355,000 a well over 15 years. Most fees will go to local governments.

The bill will also limit the ability of local governments to regulate gas development through zoning ordinances—a common industry complaint in a state with more than 100 local drilling ordinances.

The vote comes at a time when Pennsylvania is competing with neighboring Ohio and West Virginia for natural-gas development, as well as a planned $2 billion petrochemical refinery that Royal Dutch Shell PLC plans to build in one of the states.

Some environmental groups opposed the legislation and said it would prevent local governments from banning gas development in suburban neighborhoods. Jan Jarrett, chief executive of Citizens for Pennsylvania’s Future, a Harrisburg, PA nonprofit, called the bill “fatally flawed.”

— Kris Maher, Wall Street Journal