Pacific Gas & Electric reached an agreement Friday with Gov. Gavin Newsom of California in which it pledged billions of dollars to help wildfire victims, improve safety and make other changes, resolving the biggest obstacles to the company’s plan to come out of bankruptcy.

As part of the deal, PG&E, which filed for bankruptcy protection last year after amassing tens of billions of dollars in debt related to wildfires caused by its equipment, will not pay dividends to shareholders for three years. The agreement should allow the utility to exit bankruptcy by June 30, a state-mandated deadline for it to take part in a fund that will help utilities pay claims from future wildfires.

A federal judge still needs to approve the company’s bankruptcy plan, but the agreement with Mr. Newsom makes the approval much more likely.

The agreement comes as Mr. Newsom continues to manage the escalating coronavirus outbreak that led him on Thursday to order Californians to stay at home. Though the crisis has consumed much of the governor’s time, his office said the timing of the agreement was dictated by the need to meet the June 30 deadline, ahead of the next wildfire season.