The suspect has been identified as Mohammad Khaliqi, 31, of San Jose. Police arrested Khaliqi in the 1400 block of School St. in San Leandro on Friday morning.
He's facing multiple counts of burglary, attempted sexual assault and false imprisonment.
On Tuesday, the man followed the girl as she walked home from school. She told investigators he had forced his way through the front door of her home as she went inside. She fought him off and he fled before police arrived.
The girl then locked the door after he left, hid in a closet and texted her father: "DADDY COME HOME NOW. SOME GUY TRIED TO RAPE ME."
RAW VIDEO: San Jose girl fights off sexual predator in her own home
The attack was caught on the family's home surveillance system.
"The guy starts a conversation with her and when she opens up the door, the suspect pushes her in, tries to sexually assault her as well. The little girl is brave, she fights back, and the guy leaves on foot," San Jose Police Sgt. Enrique Garcia said. "He's not concerned about being caught, since he's doing this in broad daylight."
On April 2, the same suspect is believed to have followed a 28-year-old woman into a public restroom at Mitsuwa Marketplace, a Japanese grocery store at 675 Saratoga Avenue.
He attempted to sexually assault the woman in the restroom and fled before police arrived.
Police released surveillance photos of the man from both locations.
Anyone with information on these incidents or any other unreported incident is asked to contact the San Jose Police Department's Sexual Assault Investigations Unit at (408) 277-4102.