President Reagan waged one of the most sophisticated and sustained lobbying campaigns of recent years to: build support for yesterday's House vote that released $625 million for flight testing MX long-range nuclear missiles and modifying Minuteman silos to put them in.

It was a six-month drive, conceived in the despair of last December's resounding congressional defeat of the MX. The White House spared little of the traditional lobbying tools: private meetings and dinners for congressmen with Reagan at the White House, newspaper advertisements by pro-defense groups, a presidential pep talk for corporate executives and a signed editorial page article by Reagan in yesterday's Washington Post.

But to win, Reagan went further. Rather than club his Democratic opposition with rhetorical hammers, as he had done successfully so many times before, Reagan surrounded them with offers of cooperation on nuclear arms control.

In an unusual exercise in which it was not clear who was being co-opted, Reagan turned to the Washington establishment and senior Democrats to carry the day. Yesterday in the House, it was Democrats who provided his victory margin.

Hours before the vote yesterday, in a sun-splashed Rose Garden ceremony, Reagan sent another reassurance to Capitol Hill. He urged the Soviets to consider a series of steps for reducing the threat of accidental nuclear war, including improved communications links between Washington and Moscow.

At his side were Senate Armed Services Committee members Henry M. Jackson (D-Wash.), Sam Nunn (D-Ga.), John W. Warner (R-Va.) and chairman John G. Tower (R-Tex.), all key players in the upcoming Senate vote on the MX.

Twice before, Congress had sent the MX back to the drawing board. When the so-called "Dense Pack" basing mode for the missile was rejected by the House during the lame duck session last December, Reagan complained, "A majority chose to go sleepwalking into the future."

But many official who have worked on the latest bipartisan effort now say the administration was sleepwalking during the first two years as it sought to close what Reagan claimed during the 1980 campaign was a "window of vulnerability."

On the third try, White House officials said they feared a loss would be impossible to reverse. So they set out last December to find a political solution that would not fail, even if Reagan had to give a pound of flesh to his critics.

The solution was shaped through a bipartisan commission patterned after the one Reagan used to achieve a bipartisan compromise agreement to keep the Social Security System solvent.

Chaired by Brent Scowcroft, who served as President Ford's national security affairs adviser, the commission relied on prominent Democrats in the Carter administration, including former defense secretary Harold Brown and former presidential counsel Lloyd Cutler.

"The support of these people was critical to any hope of success," said a senior administration official. Another official added, "We took our chances with the Democrats. But the bottom line is that they were for the MX too."

The commission sought a way for basing the 10-warhead MX that could win political support, rather than one that made technical sense. "We did not try to devise a technical solution in a vacuum," said R. James Woolsey, a Democrat who served on the Scowcroft commission.

"Politics is an important part of strategic decisions. And when you approach problems in this way, it's sometimes difficult to know where strategy leaves off and politics begins," he said.

After the commission recommended putting 100 MX missiles in hardened Minuteman silos and building small, single-warhead missiles for deployment in the 1980s, the White House did everything it could to make it easy for Democrats to vote for the MX.

This Effort included letters to House and Senate members reaffirming Reagan's commitment to arms control and offering to incorporate suggestions of the Scowcroft commission into the U.S. negotiating position in the Geneva talks with the Soviet Union on reducing long-range nuclear weapons.

According to White House officials, Reagan realized in making these offers that Congress will hold the administration to its commitments in future votes on the MX missile. But one senior official quoted the president as saying of the Democrats, "The game they make will resound to our benefit."

It apparently has. On the night before the vote, House Majority Whip Rep. Thomas S. Foley (D-Wash.) made an appeal for bipartisanship on the issue at a White House dinner attended by the president, a White House official said. Rep. Les Aspin (D-Wis.), often a critic of administration national security programs, "carried a lot of water for us intellectually" by supporting Reagan on the MX, the official added.