Magic Johnson tweeted a picture of himself and his wife on Friday evening. “Cookie and I getting ready to go to President Obama’s birthday party!” he wrote. The Rev. Al Sharpton tweeted at 1:10 a.m.: “Leaving the White House after the celebration of President Obama’s birthday. His last birthday as President.”

Others spotted at the White House before the party included the talk show host Ellen DeGeneres; Grant Hill, a former N.B.A. star; George Lucas, the creator of “Star Wars”; and a collection of former Obama aides and media celebrities. The singer-songwriter Nick Jonas tweeted afterward: “Tonight was a night I will never forget. #BarackObama #happybirthday.” Paul McCartney was also a guest.

The president has demonstrated little interest in the political schmoozing and official social life of the nation’s capital and spends hours each weeknight largely alone, working in his private office in the White House Treaty Room. It is safe to say that more than a decade ago, when he was a little-known state senator in Illinois, he would not have expected one of the Beatles to sing him “Happy Birthday.”

But like the Kennedys, the Reagans and the Clintons, the Obamas have reached outside Washington and embraced an elite, moneyed stratum of American life. In his second term, Mr. Obama has been going to, or hosting, small dinner parties with actors, intellectuals, scientists, tech giants and billionaires. Two years ago in Rome, the architect Renzo Piano, the particle physicist Fabiola Gianotti and the chairman of Fiat, John Elkann, were at his table.

The Obamas have also insisted on keeping the partying as secret as possible. Names of those invited to nonofficial parties at the White House are never made public, and what does come out is usually from tweets from guests, like Mr. Johnson and Mr. Sharpton.