The president’s advisers argued that the broad coalition of supporters who gave Mr. Obama 53 percent of the popular vote and 365 electoral votes in 2008 never completely matched up with the traditional Democratic base. Heading into his re-election campaign and big legislative battles centering on the 2012 budget and the need to raise the federal debt ceiling, he is now well positioned to appeal to the political center even as his allies make the case that the current Republican Party is so extreme that liberals will ultimately get behind him as the best alternative.

Mr. Obama not only helped avoid the first government shutdown in 15 years, but also pressured Republicans to remove provisions intended to restrict financing for Planned Parenthood and to limit environmental regulations. In doing so, he assumed the role of a level-headed referee, rising above the squabbling to take ownership of a solution rather than a problem.

“He’s the undisputed grownup in the group,” said Jim Jordan, a Democratic strategist who has managed Senate and presidential campaigns across the country. “Presidents almost always compare well against Congress.”

The president is not, however, the only figure who survived a test from within his own party last week and emerged stronger.

Mr. Boehner, who faced an even bigger challenge than Mr. Obama, held his fractious Republican contingent together as an intense feud raged among social conservatives, the Tea Party movement and other elements of the party. But a fresh air of discipline coursed through the Republican conference, with few members speaking out against their speaker.

The budget showdown, which inched perilously close to an actual shutdown, drew attention to the ways the president’s leadership style had evolved from the early days when he often seemed deeply involved in legislative negotiations, focusing as much on details as on building a broad narrative case for his presidency. In this case, he increased his direct involvement in the negotiations in the final days, but for months let his advisers handle the details.

When an agreement was finally reached late Friday evening, Mr. Obama did not immediately rush to the cameras that had been waiting for hours. He did not proceed until Mr. Boehner had consulted Republican members, fearful that trumpeting the fragile deal from the White House could threaten it.