Continental Airlines Inc and UAL Corp's United Airlines have ironed out the last remaining wrinkle in their merger talks, paving the way for a deal that would create the world's largest carrier, two sources familiar with the matter said on Friday.

The airlines have agreed to an exchange ratio of 1.05 UAL shares for each Continental share in all-stock deal yet to be approved by the companies' boards, the sources said.

Based on United's stock price of $21.83 on Friday afternoon, and Continental's 139.6 million outstanding shares as of April 21, United would pay $3.2 billion for Continental.

That value would be determined by the market, and could change quite a bit by the time the deal closed and the shares were exchanged.

Based on current shares outstanding, a combined company would have 314.5 million shares, and UAL shareholders would own roughly 53 percent of the new company.

United's board will meet on Friday, while Continental's board will hold meetings on Friday and Sunday to discuss the deal, the sources said.

Under the terms being discussed for the all-stock merger, UAL Chief Executive Glenn Tilton would become non-executive chairman of the combined carrier while Continental CEO Jeff Smisek would become chief executive.

The combined carrier would operate under the United brand name and would be based in Chicago, sources had previously told Reuters.

United and Continental declined comment.

UAL shares closed at $21.60, up 0.6 percent on Friday while Continental shares closed at $22.35, down 1.5 percent.

The two airlines restarted merger talks in April, two years after walking away from almost sealing a deal. Continental's board voted down a similar plan two years ago, but industry experts have said an approval is more likely this year because UAL is in better financial shape.

UAL posted a narrower first-quarter loss of $82 million, compared with a year-earlier loss of $382 million. Revenue rose 15 percent to $4.2 billion.

Many airline executives have called for consolidation, saying it is a necessity to allow the industry to return to profitability.

Airlines, struggling with high fuel prices and a pullback in consumer spending amid a weak economy, have lost $50 billion in the past 10 years, according to the International Air Transport Association.

The industry lost $11 billion in 2009 alone.

Still, Continental has long said it would prefer to remain independent. But at a conference in March, CEO Smisek said the company would bulk up defensively if it would be in its best interest.

(Additional reporting by Kyle Peterson, editing by Gerald E. McCormick, Phil Berlowitz and Carol Bishopric)