Deputies were called to an apartment on Cleveland Avenue, in the Burbank neighborhood, where a man had reportedly entered an apartment without the owner's consent at about 11:35 p.m.
Several adults and children were in the apartment when 33-year-old Joe Washington allegedly walked through the apartment and into a bedroom where a 4-year-old girl was asleep, according to the sheriff's office.
A child in the living room saw the suspect and alerted the girl's parents, who were in the kitchen.
Washington, a San Jose resident, has no relationship to the family, investigators said.
When the parents went to the girl's bedroom, Washington allegedly grabbed the door and tried to keep the parents from entering, according to the sheriff's office.
A fight ensued during which the parents were able to force their way in and chase Washington out of the apartment and down the street, investigators said.
No one was injured during the altercation.
Responding deputies found Washington at his home on Vaughn Avenue and arrested him on suspicion of burglary and annoying a child.
Anyone with information about the case is asked to contact Santa Clara County sheriff's Detective Tony Hickman at (408) 808-4500. Anonymous callers can use the sheriff's tip line at (408) 808-4431.