SACRAMENTO — Nine California cities, including San Francisco and Oakland, could allow their bars to stay open until 4 a.m. under a bill that is on the verge of passing the Legislature and heading to Gov. Jerry Brown.

Under SB905 by state Sen. Scott Wiener, D-San Francisco, the cities could participate in a five-year pilot program allowing bars, nightclubs and restaurants to serve alcohol until 4 a.m., two hours later than currently allowed.

The bill passed the Assembly 46-14 Wednesday and is pending in the Senate, where a version has already passed once. If approved by the Senate before Friday’s legislative deadline, SB905 would go to Brown, who would have until Sept. 30 to sign it, veto it or let it become law without his signature. Brown has not indicated whether he would approve the bill.

Besides San Francisco and Oakland, the cities that could extend their last call would be Sacramento, Los Angeles, Long Beach, West Hollywood, Palm Springs, and the Riverside County cities of Cathedral City and Coachella.

Those cities were included because their mayors expressed an interest in participating in the pilot program. Each city would still have to decide if it wanted to extend nightlife times and could tailor the added hours in any fashion, including limiting them to certain days or neighborhoods.

Wiener first introduced the bill in 2017 as SB384, but it was watered down in the Assembly to allow only for a study about the implications of letting bars stay open later. Wiener opted to abandon the effort last year and try again this session.

“Nightlife is crucial to our culture and our economy,” Wiener said. “California’s one-size-fits-all closing time doesn’t make sense.”

Opponents, including the advocacy groups Alcohol Justice and California Alcohol Policy Alliance, say extending bar hours will mean that late-night drinkers will be on the road with early-morning commuters and will lead to an increase in drunken-driving accidents and deaths.

Conservatorships: The Assembly passed a bill Wednesday sought by San Francisco officials to expand conservatorship rules so they can have more control over who can be involuntarily held for mental-health treatment.

The bill now heads to the Senate, which has already approved a similar version. If passed there, SB1045 by Wiener would head to Brown.

The bill would allow the boards of supervisors in San Francisco, San Diego and Los Angeles counties to create five-year pilot programs that expand conservatorship rules.

San Francisco Mayor London Breed and Supervisor Rafael Mandelman testified in support of the bill at the state Capitol earlier this year, saying the city needed more power to help chronically homeless people suffering from both mental illness and substance abuse.

County mental health professionals can now hospitalize people against their will for 72 hours if they pose a danger to themselves or others or are gravely disabled because of mental illness. A county can ask a judge for a 14-day extension to continue intensive treatment and repeat that process every 30 days.

Scooters: As San Francisco prepares for the return of electric scooters, Brown will decide whether the motorized two-wheelers should be able to go faster and if helmets should be optional for adults.

AB2989 by Assemblyman Heath Flora, R-Ripon (San Joaquin County), passed the state Assembly 73-0 on Wednesday. Brown, who has until Sept. 30 to sign or veto it, has not weighed in on the bill, which is backed by one of the leading scooter rental companies, Bird.

Currently, anyone operating a motorized scooter in California is required to wear a helmet, regardless of age. That same helmet requirement does not apply to adults riding a motorized bicycle, supporters of the bill said.

The bill would also allow cities to approve electric scooters on city streets, with a maximum speed limit of 35 mph. Scooters aren’t currently allowed on streets where the speed limit is higher than 25 mph. In all other places, the scooters are limited to 15 mph, a limit that would still stand under the bill. Scooters would also still be banned on sidewalks.

Melody Gutierrez is a San Francisco Chronicle staff writer. Email: mgutierrez@sfchronicle.com Twitter: @MelodyGutierrez