After five days, the Gardner family was wondering whether Shadow, their beloved five-year-old pug, would ever return to his Lagunitas home. Grim possibilities arose: Was he hit by a car? Snatched by a coyote? Maybe even dognapped? It wasn’t like him to wonder off for long. But after they posted on Nextdoor and Instagram, neighbors quickly rallied. “Everybody in our tight-knit little community was rooting for Shadow to make it,” said Steve Gardner, who spent the week trying to reassure his sons, Rohan, 10, and Conor, 1, that their buddy would be okay. Search parties scoured the neighborhood, and Pat Odenthal, the owner of the Lagunitas General Store, looked through hours of security camera footage to see if Shadow had wandered past—in dangerous proximity to Sir Francis Drake Boulevard. Still, no sign of him. “He’s the ultimate family dog,” Mr. Gardner said. “He and our baby share food and toys and snuggle together. It’s insanely cute.” As the days and hours ticked past, Mr. Gardner considered hiring a pet detective to determine the dog’s whereabouts. But last Monday, some neighborhood kids found him in an unlikely spot: at the bottom of a 20-foot-deep hole. It was one of several that had been excavated for I-beams and a retaining wall just down Alta Avenue from the Gardners’ house. The kids called firefighters, who soon staged a rescue operation. They laid a lattice of plywood and two-by-fours over the opening to reinforce the terrain and dropped a ladder to the bottom. A video posted on the department’s Facebook page shows Shadow wagging his tail down below and pawing at the sides of the hole. A firefighter descends into the darkness, scoops him up with one hand, and climbs back up the ladder with the other. The post includes a selfie of the happy family, with Shadow cradled among them. “He was really, really, super, super, happy,” Mr. Gardner said. Neighbors celebrated online. “I just love firefighters, it’s that simple,” one person wrote. “They are all heroes that jump into action when needed.”