Democrats defied expectations and turned out an estimated 41 percent of voters in Philadelphia with an intense field operation, boosted by three recent visits from Obama. Those efforts gave Sestak a healthy margin in the city and a fighting chance to win the race.
But it was not enough to overcome Republican enthusiasm elsewhere in the state.
"The national trend was so hard, the negative campaigning, people came in and voted against anyone in office," said Delaware County Democratic Chairman David Landau. "Joe is in office."
Toomey took the stage at a Holiday Inn in suburban Allentown about 12:15 a.m. Wednesday.
"Now you knew this wasn't going to be easy," he said, to cheers. "This is a victory for the people of Pennsylvania. Today we send a simple, clear message to the establishment in Washington that we're tired of what's been going on down there and we're going to chart a new course."
In brief remarks to supporters at the Radnor Hotel, Sestak congratulated Toomey on a well-fought campaign.
"Now the best part. This is why I got in," he said, scooping his 8-year-old daughter into his arms. "It's now Alex time." He waved and walked off the stage.
Showing the polarized nature of the electorate, both Sestak and Toomey enjoyed 90 percent or better support from members of their own parties, but Toomey came out ahead among independents: 54 percent to 46 percent, according to the exit polls.
Sestak, 58, a former Navy admiral and second-term member of the U.S. House from Delaware County, has been a loyal ally of President Obama, backing the financial-system bailouts begun under President George W. Bush, the federal stimulus package, and the overhaul of the health-care insurance system.