Speaker of the House John Boehner told members of the press Thursday that Americans expect Congress to pass immigration reform. (Sarah Parnass/The Washington Post)

Prospects for the contentious immigration bill that has been working its way through the Senate for months vastly improved Thursday after senators agreed to spend several billion more dollars to fortify the U.S.-Mexico border.

The agreement calls for doubling the number of federal border agents at a cost of about $30 billion, the completion of 700 miles of fencing, and expanded radar and aerial drone surveillance at a time when the domestic use of unmanned aircraft is the subject of an acrimonious national debate.

The deal is expected to secure at least a dozen more Republican “yes” votes for the measure and could help ensure its passage by the sizable margin that proponents have said they need to make it viable in the House.

However, supporters say the chances of immigration legislation advancing in the GOP-controlled House remain a source of concern, and that concern has shaped the Senate negotiations from the outset.

Supporters have insisted that approval by a significant bipartisan majority of senators would politically compel House Republicans to vote on the Senate bill even as its members debate more limited and conservative proposals. But that is an untested proposition, and Thursday’s failure in the House of a federal farm bill, after the Senate passed its version 66-27 last week, only deepened the concerns.

House Speaker John A. Boehner (R-Ohio) sought Thursday to tamp down expectations about immigration, saying that “regardless of what the Senate does, the House is going to work its will.”

Still, there was optimism in the Senate on Thursday following the announcement of the border security agreement. Sen. John McCain (R-Ariz.) said the overall bill “is gaining Republican support” and that the new agreement “will be very helpful.”

The breakthrough is a clear victory for the bipartisan “Gang of Eight” that wrote the immigration bill, and also for several centrist Senate Republicans who were always expected to support the bill but were holding out for stricter border security provisions.

The latest changes came at the request of Sens. Bob Corker (R-Tenn.) and John Hoeven (R-N.D.), who negotiated the terms of the deal on behalf of about a dozen colleagues.

“We are investing resources in the border that have never been invested before,” Corker said in announcing the agreement. “The American people have asked us, if we pass an immigration bill on the Senate floor, that we do everything we can to secure the border.”

Sen. Lindsey O. Graham (R-S.C.), said, “If this amendment holds together and if it passes as currently constructed, border security . . . will have been achieved at a level that no one thought could have been possible just a month ago.”

In an early demonstration of how the deal might secure more GOP support, Sen. Mark Kirk (R-Ill.), who had planned to oppose the bill, said he’ll vote yes because the new border security provisions “will restore the people’s trust in our ability to control the border.”

Most of the 54 senators in the Democratic caucus are expected to support the immigration measure, in addition to McCain, Graham and Sens. Jeff Flake (R-Ariz.) and Marco Rubio (R-Fla.), who are also members of the bipartisan drafting group. Republican Sen. Kelly Ayotte (N.H.) is also on board, while at least 11 other GOP senators might decide to vote yes, according to Senate aides familiar with the issue.

The border security agreement establishes several specific conditions that would need to be met before any of the nation’s 11 million undocumented immigrants begin applying for residency status — an element of the bill that is critically important to Democrats.

First, the U.S. Border Patrol would absorb a “surge” of 20,000 additional agents that Sen. Charles E. Schumer (D-N.Y.) called “a breathtaking show of force that will discourage future waves of illegal immigration.” Schumer said “a virtual human fence” of agents could conceivably deploy every 1,000 feet along the 2,200-mile border, “all the way from San Diego, California, to Brownsville, Texas.”

The federal government also would need to complete construction of about 700 miles of fencing along the western sector of the border, essentially forcing compliance with immigration laws passed in 1996 and 2006 that authorized fence construction.

Changes in the E-Verify program that employers must use to verify a job applicant’s immigration status would need to be in place, and a biometric scanning system to catch immigrants who overstay visas would need to be operational at the nation’s largest international airports.

The agreement also authorizes the use of $3.2 billion in new border-tracking technology, including radars, scanners and at least 18 unarmed aerial drones.

“I tell you what, if you’re worried about drones, you lost big here,” Graham quipped Thursday. “If you like drones, your ship came in.”

Members of the bipartisan group that drafted the bill once considered the $30 billion price tag for new border agents too high. But aides said their concession to supply the funds was made possible by this week’s Congressional Budget Office report that estimated that the legislation would reduce federal deficits by nearly $200 billion over the next decade.

“We didn’t know we had the dollars; we have them now,” Schumer said.

The additional funding did not make everyone happy. A group of conservative senators, including Jeff Sessions (R-Ala.), Ted Cruz (R-Tex.) and Mike Lee (R-Utah), called the new border security deal a weak and costly attempt to stop illegal immigration.

“This is going to repeat a couple of mistakes that too often in Washington we make,” said Sen. Charles E. Grassley (R-Iowa), a leading critic. “Too often success in Washington is measured by input — how much money you’re going to spend — while we ought to be measuring success of legislation by results and the outcomes.”

“This is turning out to be 1986 all over again,” Grassley warned, referring to an immigration bill signed that year by President Ronald Reagan that members of both parties believe failed to sufficiently address the issue.

McCain dismissed the criticism, saying, “If they can’t accept these provisions, then border security is not their problem.”

Aaron Blake contributed to this report.