WASHINGTON — The House on Wednesday overwhelmingly approved legislation to end the federal government’s bulk collection of phone records, exerting enormous pressure on Senator Mitch McConnell of Kentucky, the Senate majority leader, who insists that dragnet sweeps continue in defiance of many of those in his Republican Party.

Under the bipartisan bill, which passed 338 to 88, the Patriot Act would be changed to prohibit bulk collection by the National Security Agency of metadata charting telephone calls made by Americans. However, while the House version of the bill would take the government out of the collection business, it would not deny it access to the information. It would be in the hands of the private sector — almost certainly telecommunications companies like AT&T, Verizon and Sprint, which already keep the records for billing purposes and hold on to them from 18 months to five years.

So for the N.S.A., which has been internally questioning the cost effectiveness of bulk collection for years, the bill would make the agency’s searches somewhat less efficient, but it would not wipe them out. With the approval of the Foreign Intelligence Surveillance Court, the spy agencies or the F.B.I. could request data relevant to an investigation. Corporate executives have said that while they would have to reformat some data to satisfy government search requirements, they could most likely provide data quickly.

The legislation would also bar bulk collection of records using other tools like so-called national security letters, which are a kind of administrative subpoena.