After locating Petey, one of the firefighters crawled into a hole and managed to pull him out just before midnight.
L.A. County firefighters had to dig deep during the rescue. Video shows half of the rescuer's body underground with his feet hanging out.
Authorities estimate the dog was trapped 6 feet below the surface.
The white dog was covered in dirt but wasn't hurt. Firefighters said they plugged up the holes before leaving the scene.