Dustin Moskovitz, at 27 the world's youngest billionaire, gained fame and fortune after founding Facebook with Mark Zuckerberg.
He also gained the "Facebook 15." He packed on the extra pounds while chowing down on free snacks and guzzling four sodas a day at the social networking giant.
Today, Moskovitz is a svelte version of his former self. He runs Asana, a start-up named for the Sanskrit word for traditional yoga sitting positions. That's fitting since the company holds twice weekly group yoga classes at its San Francisco offices. It also employs a full-time chef who prepares two meals a day for 23 employees and stocks the office kitchen with fresh fruit, nuts and yogurt.
"If the micro-kitchen stocks Coke, I'll drink it," Moskovitz said. "So we don't."
Gadgets aren't the only things slimming down in Silicon Valley.
Some tech workers -- their personal bandwidth expanding from too much sitting and too much food -- are reprogramming their bodies the way they would machines. They sleep with devices that measure their REM, load up on low glycemic food to sustain energy levels naturally and work at desks while standing or walking on treadmills.
And they're getting help from employers. Tech companies have long attempted to squeeze every bit of productivity from their staffs, offering perks like free meals and gofers to run errands to keep employees glued to their screens.
But all that work and too little play can wreak havoc on creativity. Some firms are now encouraging workers to get moving to maintain their competitive edge. Google even has a seven-person bicycle as an alternative to piling into conference rooms for meetings.
"We are all running a million miles an hour," said venture capitalist Tim Chang, managing director of Mayfield Fund. "Burnout is a big risk for engineers. You need a sustainable lifestyle."
Of course, bad habits die hard. Sleepless nights and micro-kitchens stocked with sugar and soda are still the norm at tech giants and start-ups alike. Pizza joints in Palo Alto aren't in danger of going out of business.
Still, a pronounced behavioral shift is taking place, particularly among entrepreneurs age 30 and over. Digg founder Kevin Rose, 35, said he grew up in Las Vegas on a steady diet of Taco Bell, Burger King and Dr Pepper. Now his beverage of choice is loose-leaf tea. He carries a Fitbit device with him to track how many steps he takes and how many calories he's burning. He jumps on a treadmill desk to bang out emails.
"For a generation of geeks now in our mid-30s, you realize your body just can't take the damage like it used to be able to," said Rose, who sold his mobile apps maker Milk to Google last month.
One driving force behind Silicon Valley's health kick: innovation. Tech workers who have spent their days obsessively crunching data, at the expense of their abs, are now embracing digital fitness tools to keep themselves in shape.
San Francisco entrepreneur Brit Morin tracks her movements with a Jawbone Up wristband and weighs herself on a Withings Wi-Fi scale. When the 26-year-old goes jogging, a Nike Fuelband and the Nike app posts details of her runs to Path and Facebook. Nutrition apps help her watch what she eats.
For Keith Rabois, 43, chief operating officer of San Francisco's mobile payments company Square, preparing for work begins at bedtime. For more than three years he has been strapping on a Zeo monitor nightly to score how well he sleeps. If he has a high score when he wakes up, he jumps out of bed. If he has a low score, he turns over to catch a few more Z's.