About 37,000 customers in Daly City and South San Francisco lost power at about 6:40 p.m., spokesman J.D. Guidi said. Power was restored at about 8:40 p.m.
Another 5,185 customers also lost power at about 8:05 p.m. in San Francisco's Haight-Ashbury neighborhood and Richmond District, Guidi said. Power was restored at about 9:10 p.m.
Guidi said the cause of the outages was still under investigation.
The loss of power coincided with wind and flood advisories in San Francisco as rain pounded the Peninsula.
Up to four inches of rain were forecast across the Bay Area, along with wind of up to 55 mph and possible urban flooding.
To help residents prevent flood damage, government agencies in the North Bay provided free sandbags and sand on Tuesday. A sandbag station is located in the city of Napa in the parking lot on the west side of Freeway Drive at First Street, city officials said.
There are also two stations set up in unincorporated Napa County, one at 3535 N. St. Helena Highway and another at 1501 Milton Road.
Petaluma city officials are also offering free sandbags. Residents can go to Hopper Street just west of Lakeville Street.
People in need of sandbags should bring their own shovels and gloves and be prepared to fill and transport the bags.
A flood warning has been issued for the Navarro River in Mendocino County. It is expected to crest at 24 feet by 4 a.m. Wednesday morning and then recede below flood stage at 7 a.m. Highway 128 may flood which would cause it to be closed to traffic.
There were a number of car accidents all around the East Bay Tuesday night and on I-880.
A tree fell closing the freeway onramp onto I-80 at the El Portal exit in San Pablo. It caused one driver to crash, but he was uninjured. Another car accident happened on southbound I-680 in Walnut Creek made for a very slow evening commute.
In the flood prone Tara Hills neighborhood in San Pablo many storm drains were clogging up with debris early on in the night.
Bay City News contributed to this report