Lyft Inc. is selling its self-driving division to a unit of Toyota Motor Corp. for $550 million, a move the ride-hailing giant said will help it turn a profit sooner than previously expected.

Woven Planet Holdings, a Toyota subsidiary focused on autonomous technology, will pay $200 million up front as part of the deal, Lyft said Monday. The remaining $350 million will be paid in cash over a five-year-period.

Lyft’s departure from building self-driving cars follows rival Uber Technologies Inc.’s decision to shed its autonomous-driving division in December. The money-losing companies overhauled their businesses during the coronavirus pandemic and pledged to scale back on costly ventures as the health crisis crushed their core rides operations.

Lyft said the sale would help it save $100 million in operating expenses, accelerating its path to profitability. The company said it now expects to become profitable on an adjusted basis before interest, taxes, depreciation and amortization in the third quarter. Previously, it expected to reach that milestone in the fourth quarter, alongside Uber.

Both companies spent big to expand into areas beyond ride-hailing in recent years, fueled by investors who backed their wide-ranging ambitions. But enthusiasm waned as they amassed billions in losses along the way. The pandemic dealt the final blow, forcing the companies to shed costly new bets.