SACRAMENTO — Bars will not be allowed to stay open later in San Francisco and Oakland after Gov. Jerry Brown vetoed a bill Friday that would have extended last call for alcohol until 4 a.m.

The bill would have allowed nine cities to participate in a five-year pilot program to extend the time alcohol can be served at bars, nightclubs and restaurants by two hours, starting in 2021. Besides San Francisco and Oakland, the cities that could have extended their last calls from 2 a.m. were Sacramento, Los Angeles, Long Beach, West Hollywood, Palm Springs, and the Riverside County cities of Cathedral City and Coachella.

SB905 by state Sen. Scott Wiener, D-San Francisco, would have allowed the cities to tailor the added hours in any fashion, including limiting them to certain days or neighborhoods. The cities were included in the bill after their mayors expressed an interest in participating.

Now Playing:

“Without question, these two extra hours will result in more drinking,” Brown wrote in his veto message. “The businesses and cities in support of this bill see that as a good source of revenue. The California Highway Patrol, however, believes strongly that this increased drinking will lead to more drunk driving.”

The governor added, “I believe we have enough mischief between midnight and 2 without adding two more hours of mayhem.”

Wiener argued that “California’s one-size-fits-all closing time doesn’t make sense. When it comes to nightlife you can’t compare downtown Los Angeles or San Francisco to small town.”

In a statement, he added, “We are forcing all of our cities to conform to the same closing time regardless of the varying needs and wants of the local community. ... It is a shame that we will continue to stifle our nightlife economy, but I remain committed to modernizing these outdated laws.”

It was Wiener’s second attempt at passing a bill to extend nightlife hours.

Opponents, including the advocacy groups Alcohol Justice and California Alcohol Policy Alliance, said extending bar hours would put more late-night drinkers on the road with early morning commuters. They argued that would lead to an increase in drunk-driving accidents and deaths.

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