The advertisement, which was scheduled to start running on Saturday, shows Mr. Obama praising Mr. Brown for sponsoring a bill to end insider trading in Congress. As Mr. Obama signs the measure into law, he thanks Mr. Brown, saying, “Good job.”

With the political conventions over and the Labor Day parades behind them, Mr. Brown and Ms. Warren are entering a new phase of their intensely fought race, the most expensive Senate contest in the country and one of a handful that will determine which party controls the chamber next year. The race is distinctive in another way: in this state, Mr. Obama is so popular that candidates from both parties are trying to hitch their wagons to his star.

That approach would be unusual enough for a Democrat in a year in which many feel the need to distance themselves from the administration, but it is virtually unfathomable for a Republican. That both candidates are trying to leverage their ties to Mr. Obama underscores how popular the president is here and how unpopular his rival, Mitt Romney, is, even though he once served as the state’s governor. Mr. Obama is expected to carry Massachusetts overwhelmingly in November.

Mr. Brown’s new ad is a clear overture to independent voters, who make up more than 52 percent of the state’s electorate. It seeks to reassure them that splitting their ticket — voting for a Democrat for president and a Republican for the Senate — can still mean that things will get done in Washington.

The commercial follows weeks of other ads in which various former Democratic officeholders have endorsed Mr. Brown; on Friday, his campaign rolled out a “Democrats for Brown” coalition that includes a state representative, Christopher G. Fallon of Malden, and other officials.

The strategy may be paying off. Over the last few weeks, Mr. Brown appears to have been inching ahead of Ms. Warren in the polls, though the race still seems to be within the statistical margin of error. Significantly, he has been building a strong lead over Ms. Warren among independents. Polls suggested that he was attracting as many as one in five Democrats and one in four Obama voters.

“The race is going to be won or lost among the independents,” said David Paleologos, a pollster at Suffolk University in Boston. “The onus is on the Warren campaign to define and clarify what having a Republican Senate means and to force people to vote straight Democratic.”

Ms. Warren was able to cloak herself in the Obama glory last week with a prime-time speaking role at the Democratic National Convention in Charlotte, N.C. (Mr. Brown, by contrast, opted out of a speaking role the previous week at the Republican National Convention in Tampa, Fla.)

Photo

Elizabeth Warren is Mr. Brown's Democratic rival in Massachusetts.Credit
Gretchen Ertl for The New York Times

Mr. Obama makes regular cameos in Ms. Warren’s television ads, usually with the two of them in the Rose Garden. And on Thursday night, after officially becoming the Democratic nominee for the Senate seat, Ms. Warren noted in a statement that her name would appear on the November ballot “just below President Barack Obama’s,” a reminder of how easy it would be to vote a straight ticket.

But Ms. Warren’s anticorporate, anti-Wall Street message seems aimed squarely at the party’s progressive wing, which is more enthusiastic about her than it is about Mr. Obama. Her strategy so far seems to be to fire up that base and hope the moderates and independents come along.

Ms. Warren, who teaches at Harvard Law School, said Thursday that she would not adjust her message to try to appeal more to independents or to any particular group, adding that she was simply giving voice to the concerns that voters have raised with her.

“I’m not a politician, and the idea that I could calibrate something is just kind of beyond my reach,” Ms. Warren said outside her polling place here after voting for herself in her party’s uncontested Senate primary.

Meanwhile, the political world is waiting for Mayor Thomas M. Menino of Boston, a Democrat who sits atop a potent political machine, to choose sides. Insiders speculate that he will soon endorse Ms. Warren, but he is friendly with Mr. Brown and has teased out his neutrality long enough to give her campaign the jitters.

A version of this article appears in print on September 9, 2012, on page A16 of the New York edition with the headline: G.O.P. Senator Uses President for Help in Ad. Order Reprints|Today's Paper|Subscribe