Barack Obama shares his No. 1 piece of advice for his own daughters: Don’t let your hunger for success ruin your happiness

You might think it’s worth sacrificing vacations, family time and sleep for your career — especially if it leads to a raise or promotion.

It’ll also make you a lot unhappier, says former U.S. president Barack Obama.

“What you want is a balance,” Obama told LinkedIn News‘ “This Is Working” podcast on Thursday. “Young people [should be] looking for work that they find interesting, that they can throw themselves into, but not [as] a substitute for the other aspects of our lives — volunteering, family, friendships, civic engagement — that make for a well-rounded life.”

The problem, Obama added, is that a lot of people view “success” as attaining money, a job title or professional status. “So much of what’s important in life may not come through your work,” he said.

His advice for his two daughters, both of whom are in their 20s: Don’t let your hunger for success keep you from enjoying life.

Obama’s guidance follows multiple recent regretful statements from billionaires who leaned into their workaholic tendencies while amassing much of their wealth.

Last month, Microsoft co-founder Bill Gates told recent graduates at Northern Arizona University that he sacrificed too much of himself while building his company — and unfairly expected his employees to do the same.

“When I was your age, I didn’t believe in vacations. I didn’t believe in weekends. I didn’t believe the people I worked with should either,” Gates said, noting that it took becoming a dad for him to realize “there’s more to life than work.”

Similarly, Tesla CEO Elon Musk told CNBC’s David Faber last month that tactics like pulling all-nighters and sleeping under his desk to get work done ultimately thwarted his productivity.

“I’ve tried [to sleep] less, but … even though I’m awake more hours, I get less done,” Musk said. “And the brain pain level is bad if I get less than six hours [of sleep per night].”

The happiest, “most successful people” are the ones who prioritize their personal lives just as much as their professional ones, Obama said.

“Hopefully, you will have wonderful people that you work with and make lasting friendships — but a lot of your friends are going to be people you don’t work with,” he said. “Your family, the hours that you’re home, are going to be probably more meaningful for you over the long term. Those intimate relationships that you have.”

DON’T MISS: Want to be smarter and more successful with your money, work & life? Sign up for our new newsletter!

Get CNBC’s free report, 11 Ways to Tell if We’re in a Recession, where Kelly Evans reviews the top indicators that a recession is coming or has already begun.

Why Barbara Corcoran doesn't save money — and how it's made her rich