The Justice Department disclosed the plans on Sunday.
The department filed suit April 6 to block the merger of Halliburton and Baker Hughes. It claims the transaction would unlawfully eliminate significant competition in almost two dozen markets crucial to the exploration and production of oil and natural gas in the United States.
"The companies' decision to abandon this transaction — which would have left many oilfield service markets in the hands of a duopoly — is a victory for the U.S. economy and for all Americans," Attorney General Loretta E. Lynch said in a statement on Sunday.
Justice officials said the merger of Halliburton and Baker Hughes would have raised prices, decreased output and lessened innovation in at least 23 oilfield products and services critical to the nation's energy supply.
As part of the agreement, Halliburton will pay Baker Hughes the termination fee of $3.5 billion by Wednesday, according to a joint release from the companies.
"While both companies expected the proposed merger to result in compelling benefits to shareholders, customers and other stakeholders, challenges in obtaining remaining regulatory approvals and general industry conditions that severely damaged deal economics led to the conclusion that termination is the best course of action," Dave Lesar, Halliburton's chairman and CEO, said.
"Today's outcome is disappointing because of our strong belief in the vast potential of the business combination to deliver benefits for shareholders, customers and both companies' employees," Martin Craighead, Baker Hughes' chairman and CEO, said.
Baker Hughes said it is now taking steps to remove costs that were retained in order to comply with the now abandoned deal. Those steps include a strategy to refocus its sales channel and retain a selective footprint in the U.S.
The company will also buy back up to $1.5 billion in stock and about $1 billion in debt, all from the proceeds of the $3.5 billion breakup fee. It will also refinance a $2.5 billion credit facility. Overall, the company expects $500 million in annual cost savings by the end of the year.
Halliburton and Baker Hughes announced their plan to combine in November 2014, shortly after oil prices began to fall. Few, however, predicted the depth and duration of lower prices caused by a global oversupply of oil.
The glut slowed demand for drilling services and crushed the stock price of both companies.
The Justice Department indicated its concern about the acquisition in a lawsuit it filed against ValueAct Capital, a hedge fund that had bought more than $2.5 billion in stock of Halliburton and Baker Hughes.
The department said in the lawsuit that a Halliburton-Baker Hughes merger "threatens to substantially lessen competition in numerous markets."
Europe's top regulator, the European Commission, said it had also had concerns about the deal. It said that it had investigated its potential impact on competition together with regulators in the U.S., Brazil and Australia.