The asset swap sees Whitbread take on 21 Express by Holiday Inn hotels and 1,245 rooms, while M&B gains 44 stand-alone Brewers Fayre and Beefeater sites.
Both the hotels and pub estate had approximate profits of £9m each last year and are each valued at £78m.
On completion of the deal on 19 September the 400 hotel employees will transfer to Whitbread, while the 1,300 pub restaurant staff will transfer to M&B.
Whitbread said the 44 pub restaurants sold were on sites where development of a Premier Inn had not been possible due to planning constraints.
It added it would continue with plans to develop a Premier Inn on the 51 sites it has where there is currently not a hotel.
Alan Parker, chief executive officer of Whitbread said: "It increases the profitability of the hotels, will increase occupancy and take out the agent discount. In terms of Premier Inn's targets, our aim is to open 4,000 rooms this year. This represents 1500 and is more of a leap than a step in the right direction."
Parker added that the deal left Whitbread with 359 pub restaurants, with plans to open another 14 next year, and he was planning a cash injection for the 21 M&B hotels in the next few months.
"We will spend a further £18m on refurbishing bedrooms, installing kitchens to enable the hotels to provide a hot breakfast, and installing new signage and systems in next few months," he said.
Tim Clarke, chief executive of M&B, said: "Our brands can add a lot of value to these pub restaurant sites as we have shown with previous acquisitions."
It has been rumoured for more than two years that M&B has been interested in Whitbread's estate.
By Christopher Walton and Gemma Sharkey
E-mail your comments to Christopher Walton here.