The House of Representatives passed a controversial cybersecurity bill on Thursday in the face of warnings that it undermined privacy and a threat from White House advisers warning they would recommend President Barack Obama veto the legislation.

The Cyber Intelligence Sharing and Protection Act (Cispa) passed by a 288-127 vote, receiving support from 92 Democrats. It will move to the Senate and then to the president's desk.

The bill allows private businesses to share customers' personal information with any government entity, including the National Security Agency.

Reintroduced in February after failing to pass Congress last year, the bill would afford legal protection to the government and businesses to share data with each other on cyber threats.

Its co-author, Mike Rogers, the intelligence committee chairman and a Republican from Michigan, argues that cyberattacks and espionage, particularly from China, where a number of high profile attacks have originated recently, are a number one threat to US economic security.

"We have a constitutional obligation to defend this nation," said Rogers, on the House floor. "This is the answer to empower cyber information sharing to protect this nation, to allow those companies to protect themselves and move on to economic prosperity. If you want to take a shot across China's bow, this is the answer."

Earlier this week, Rogers dismissed opponents of the bill as teenagers in their basements.

Dutch Ruppersberger, a Democrat of Maryland, the other co-author of the bill, said on Wednesday during debate on the issue that $400bn worth of American trade secrets are being stolen by US companies every year.

"If your house is being robbed, you call 911 and the police department comes. That's the same scenario we are looking at here," he said.

At one point, Mike McCaul, a Republican from Texas, attempted to draw a comparison between the terror attack in Boston on Monday and cyberterrorism, to draw support for the bill's aim to improve security. "Recent events in Boston demonstrate that we have to come together as Republicans and Democrats," he said, according to Reuters.

"In the case of Boston, there were real bombs," said McCaul. "In this case, they are digital bombs – and these digital bombs are on their way."

Nancy Pelosi, the House Minority leader, expressed the same concerns shared by the White House and civil liberty groups that the bill had failed to strike a "crucial balance between security and liberty".

"Im disappointed that we did not address some of the concerns mentioned by the White House about personal information," Pelosi said. "Unfortunately, it offers no policies and did not allow any amendments or real solution that upholds Americans' right to privacy."

Last year, global protests by a coalition of internet activists and web companies, including Google and Wikipedia and Twitter, scuppered a similar bill, the Hollywood-backed Stop Online Piracy Act. At the time they warned that future attempts to push through legislation that threatened digital freedoms would be met with a similar response.

Holmes Wilson, co-founder of online advocacy group Fight For the Future, said he and other critics would continue to lobby against Cispa. "It would have been so easy to fix this bill and require sites to strip out personal information before passing them to the government." he said.

He said amendments had been made in closed sessions and it was "not out of the question" that privacy protections had been left out intentionally at the behest of the intelligence agencies.

House intelligence committee leaders addressed some privacy concerns by endorsing an amendment that gave the job of clearing house for the exchange data to the Department of Homeland Security and the Justice Department, rather than a military agency.

The bill has attracted support from tech giants including IBM who are keen for liability protection from consumers whose information they have shared, said Wilson. "Right now if the government wants users' information, the company can say no because it opens them up to being sued," he said. "If Cispa passes, there will be no legal restraint."

Kurt Opsahl, senior staff attorney for the Electronic Frontier Foundation, which had unsuccessfully urged the House to adopt an amendment that would have allowed companies to make a privacy contract with their customers, said it was a "poorly drafted" bill that would present a "gaping exception to bedrock privacy law".

The American Civil Liberties Union, one of 34 groups that wrote to lawmakers this week urging them to oppose the bill, said they would work with Congress to ensure the next version of information-sharing legislation resolves the privacy issue and protects personal information online.

"CISPA is an extreme proposal that allows companies that hold our very sensitive information to share it with any company or government entity they choose, even directly with military agencies like the NSA, without first stripping out personally identifiable information," said Michelle Richardson, legislative counsel at the ACLU's Washington Legislative Office.

A Sunlight Foundation report recently revealed that interest groups in support of the bill spent $605m from 2011 to the third quarter of 2012 – 140 times as much lobbying Congress as those on the other side of the debate, who spent $4.3m.

The bill's opponents, which include digital rights organisations and Internet companies like Reddit and Craiglist, petitioned the White House and submitted more than 300,000 signatures to the House Intelligence Committee. Microsoft and Facebook also oppose the bill, according to Reuters.

Several influential industry groups had come out in support of the bill, including the wireless group CTIA, the US Chamber of Commerce and TechNet, which represents large internet and technology companies.