Not long ago, employees at Practice Fusion Inc. reveled in the technology boom, munching daily on free healthy food, enjoying “Phenomenal Friday” gatherings and racing around the office on tricycles.

Today, the Silicon Valley extravaganza is waning. The San Francisco electronic medical-records company has booted its founding CEO, laid off a quarter of its staff and cut back on projects to save costs.

“A...