Officers responded to a report of shots fired near a home in the 2500 block of Golden Gate Avenue at around 9:30 p.m., San Francisco police Officer Albie Esparza said.
A 21-year-old man told police he was letting a friend out when four men rushed the door and broke in, demanding money.
The victim was pistol-whipped by the intruders, who stole an electronic gaming system, a wallet and a cell phone before fleeing in a newer-model Jaguar, Esparza said.
As the four suspects fled, at least one of them shot at the victim, who shot back at the suspects, Esparza said.
No one was wounded in the exchange, Esparza said. The victim was taken to a hospital to be treated for lacerations to the face.
Anyone with information regarding the case is urged to contact San Francisco police at (415) 575-4444.