Removing Adam Pye, 26, from the sand Monday afternoon took about half an hour, officials said. He had dug about 10 feet down on the beach at Half Moon Bay when the walls caved in.
"It is one of those situations that can go from having a good time on the beach with friends and family to extremely dangerous and critical within seconds," said Jonathan Cox, a spokesman for Cal Fire.
Pye lived in San Lorenzo in Alameda County, east of San Francisco.
Cal Fire warned area residents and visitors that beaches can be dangerous places.
"Remember to stay away from cliffs, use caution when swimming in big surf and refrain from digging too deeply in the sand," the agency said in a statement.