The move comes after bus operator First Scotland East announced it was to close routes and withdraw services in August – placing almost 90 jobs at risk.
It also planned to close its depots in North Berwick and Musselburgh, blaming an “increasingly competitive market”.
East Coast Buses Ltd – a wholly-owned subsidiary of Lothian Buses – will now buy the company’s Musselburgh and North Berwick properties.
The firm pledged to make “significant investment to improve services”, including refurbishment works to the Musselburgh garage, increasing the number of vehicles and deploying a new fleet.
Iain Gray, MSP for East Lothian, hailed the announcement as “great news”.
He said: “The most important thing is that county commuters know they will not be left without a bus service, but it is also very welcome that the jobs threatened by First’s withdrawal have been saved.
“The most exciting thing, though, is the prospect of better bus services at last. When First abandoned Pencailtand and Ormiston four years ago, Lothian introduced the 113 route, which was just voted the best bus service in Scotland.
“I already have an early meeting arranged with Lothian to discuss their plans and suggest how they can meet passenger’s needs better than First have done for many years.”
Richard Hall, managing director of Lothian Buses, said: “This deal will protect key bus services and jobs but the benefits go much further than that.
“The residents, workers and businesses of East Lothian rely on buses for their daily lives and well-being.
“We are pleased to be in a position to take on and continue providing these vital services and be part of the local economy.”
Changes set to be introduced after the takeover in August include a new 60 minute timetable – 30 minute at weekday peak times – for the 107 service running from the West End to Dunbar. A 30 minute timetable will also be brought in for the 124/X24 from Semple Street to North Berwick, reducing to 60 minutes on Sundays.
Paul McGowan, managing director of First Scotland East, said: “Throughout our consultation into the future of bus services in East Lothian our priority was to safeguard jobs and protect key services. I am therefore pleased that we have achieved that through the proposed sale to Lothian Buses.
“I’d like to thank all my colleagues in East Lothian for their hard work and loyalty over the years. We will be fully supporting them as they transfer to their new employer.
“We are proud to have served the East Lothian community and would like to thank passengers for travelling with First Scotland East over the years.”