Surveillance cameras captured the frightening encounter Tuesday morning in Stanislaus County.
Authorities say a man, identified as Daniel Diaz, a registered sex offender, was seen loitering outside the home and tried to open the house door.
The family told him to leave, but Diaz went to to the side of the house.
Police say he pulled the screen out of a window and climbed into the bedroom of a 5-year-old girl.
RELATED: Tackle of the year: Texas mom takes down man suspected of peeping in her daughter's window
The suspect turned on the lights, and that's when the child's father came running in and tackled Diaz.
"I was pretty scared because I thought the man would've taken him and kidnapped (my sister)," said Ceci Ramirez.
"It's really sad that people are outside doing things like that," said the family's neighbor, Erica.
The girl's father managed to bring Diaz outside and restrain him with duct tape until officers arrived.
Fortunately, no one was hurt in the incident, but family members say they no longer feel safe.