GLENOLDEN, Pa. — Senator Patrick J. Toomey hears a lot of things he would rather not these days, like the taunts of protesters outside a body shop here about his (actually nonexistent) relationship with Donald J. Trump.

But he never tires of the many people who approach him, sometimes quietly, with praise for his support for tightening restrictions on gun buyers, voters “who recognize it was a politically difficult thing to do,” he said.

Mr. Toomey, a conservative Republican in a tough re-election fight in Pennsylvania, has been rewarded with support from unlikely sources: former Representative Gabrielle Giffords of Arizona, a Democrat who was shot in the head in a 2011 assassination attempt and started a political action committee focused on gun control, and Michael R. Bloomberg, a former mayor of New York, who is behind another gun control PAC.

But the two are also backing Gov. Maggie Hassan of New Hampshire, the Democratic challenger to Senator Kelly Ayotte, a Republican who has opposed the legislation that bears Mr. Toomey’s name. Ms. Hassan and Ms. Ayotte are locked in one of the tightest Senate races in the country.