The U.S. House of Representatives has narrowly rejected an effort to stop the National Security Agency from collecting millions of U.S. residents' telephone records.