The shooting was reported at 3:50 a.m. in the 100 block of Gladstone Drive, located atop a hilly section of the Excelsior District, police spokeswoman Sgt. Lyn Tomioka said.
The suspect, described as a man in his mid-20s, allegedly broke a window of the home to get inside.
The suspect was confronted by the homeowner, pulled a gun and began shooting, and then fled on foot, Tomioka said. Police were unable to locate him.
The victim was driven to San Francisco General Hospital. The extent of his injuries was not immediately known.