The amendment, attached to a bill that would toughen Megan's Law registration requirements, still must get final approval by the Senate, which is likely Thursday, and clear the House, which approved a similar measure last week.
Gov. Rendell has said he would review the bill.
The castle doctrine's approval came over the objections of the major law enforcement organizations in the state.
The same groups - the state police, the police chiefs association, and district attorneys association - supported the closure of the so-called Florida loophole, which was defeated, 29-20.
Gun-control proponents say the loophole allows individuals who may have been rejected by Pennsylvania authorities to obtain a gun permit in other states.
Florida, Utah, and New Hampshire issue permits to nonresidents even if the applicants' home states have denied or revoked permits. Florida alone has issued between 3,000 and 4,000 permits to Pennsylvania residents.
Sen. Daylin Leach (D., Montgomery) offered the amendment, saying that closing the loophole would help stop criminals from having access to guns and would not affect law-abiding citizens.
The loophole "turns over Pennsylvania authority about who can and can't get a gun to another state. . . . Would we do this in any other context?" Leach said.
Sen. Robert Robbins (R., Butler) said Philadelphia residents were being forced to go to other states because authorities have "reinterpreted" the state law. He said he had heard of cases where people were denied gun permits for minor infractions like parking tickets.
Leach argued that if Philadelphia was violating state law, then people could sue the city, and he told lawmakers that if the state law was too weak, then change the law.
"What we don't have the right to do is ignore Pennsylvania law," he said.
Rep. Shirley Kitchen (D., Phila.) admonished her colleagues for trying to blame Philadelphia.
"Philadelphia should blame the state for not helping with legislation to stop the flow of illegal guns," she said. "People are desperate to get guns out of the hands of teens."
Robbins praised the passage of the castle doctrine for affirming a basic right of U.S. citizens.
"A principle at the heart of every civil society" he said, "is that we have a right to defend our homes."
For Pennsylvania Senate
roll call votes, go to
Contact staff writer Amy Worden at 717-783-2584 or email@example.com.