United Airlines and Continental Airlines agreed Sunday to a $3 billion merger that would create the world’s biggest airline, according to people briefed on the negotiations.

The deal, to be announced officially on Monday, would form a coast-to-coast behemoth with a leading presence in the top domestic markets, including New York, Chicago and Los Angeles, along with an extended network to Asia, Latin America and Europe. The deal was completed in a remarkably swift three weeks, and would give the airlines the muscle to fend off low-cost rivals at home and to take on foreign carriers abroad.

United is buying Continental, and the combined company will keep the United name and be based in Chicago. Jeffery A. Smisek, Continental’s chief executive, would run the company. If the deal wins antitrust approval, the merged airline would replace Delta Air Lines as the top carrier.

The boards of both companies met Sunday to approve the all-stock deal, according to people familiar with the companies who spoke on condition of anonymity because the negotiations were delicate. The UAL Corporation, United’s parent company, would issue 1.05 shares for each Continental share, valuing the acquisition at $3.17 billion, based on Friday’s closing price. The merger is expected to be completed before the end of the year.