The incident occurred about an hour after a man with a similar description tried to break into another home a couple of miles away, but was unsuccessful.
"So far, it looks random," said Ontario police Sgt. David McBride. "For whatever reason, he just chose these two houses."
Daniel Anthony Aguirre, 20, was booked into West Valley Detention Center in Rancho Cucamonga on suspicion of burglary and sexual assault.
Officers came to the 200 block of North Vine Avenue in Ontario at 9:49 a.m. on a report of trouble at the residence.
They discovered a man got into the home through an unlocked door and confronted a 41-year-old woman. Police say he pointing a realistic-looking handgun at her. He attacked the woman and fled before police arrived.
Police searched the area and found Aguirre walking in the 500 block of West Holt Boulevard. He was carrying a pellet gun.
Detectives say a similar incident occurred in the 100 block of North Pleasant Avenue. That man ran off after he couldn't get into the home.
Police say all the doors on the Pleasant Avenue home were locked.
Taking precautions for a random crime is difficult, but police say keeping doors locked at all hours is a good idea.
"It doesn't matter whether it's day or night - just as a precaution," McBride said.
Anyone with information may call Ontario police Detective John Gonzales, 909-395-2001.
Reach Melissa via email or call her at 909-386-3878.
Get the latest crime and public safety news on Twitter @IECrime.