The boy had been playing with a ball in his backyard on Shirley Court at about 4 p.m. when he hit the ball over the fence and went after it, police said.
He climbed up onto a small shed, slipped over the fence into his neighbor's yard, and was then attacked by three pit bulls, police said.
The boy's father heard his son screaming and jumped over the fence toward the noise. He fought off the pit bulls using his fists and a piece of wood.
Responding medics treated the pair for bites, bruises and lacerations. The boy and father were taken to the hospital for treatment and are expected to survive.
The three dogs were taken to the Tri-City Animal Shelter and held for a 10-day quarantine while investigators find out if the trio had their rabies shots.
The owner of the dogs cooperated with police and said none of the dogs had ever been in a biting incident.
Anyone with information is encouraged to call Union City police at (510) 471-1365.