The fire was reported around 6:35 a.m. in the 100 block of Bright Street near Stanley Street.
The blaze was controlled at 9:19 a.m., according to fire spokeswoman Mindy Talmadge.
Three homes were heavily damaged.
Two people were taken to the hospital, including one with serious injuries. A firefighter also suffered minor injuries and was transported, according to Talmadge.
San Francisco Municipal Railway light-rail service on the M-Oceanview line was disrupted until just before 10 a.m. Regular service has resumed, according to Muni officials.
A bus bridge had been in effect to take southbound passengers past the fire scene.