In July, David Byttow and Chrys Bader won the startup lottery, reaping millions of dollars in cash from the company they founded.

But they didn’t sell their San Francisco company, stage an IPO or generate any revenue—the typical route to technology riches. The pair had only launched their startup, maker of a messaging app called Secret, seven months earlier.

Rather, the co-founders together made about $6 million from selling some of their shares in the startup to venture capitalists as part of a $25 million, early round of financing, according to people with knowledge of the deal. Even if the business flops—and research shows most startups fail to return investors’ capital—Messrs. Byttow, 32 years old, and Bader, 30, will still be millionaires.

Such deals, while rare, are increasingly rippling through Silicon Valley, say venture capitalists, as entrepreneurs gain the upper hand in a frothy startup market. Venture-capital firms are hungry to own as many shares as possible—a 20% or higher stake—so in some cases they are letting founders take money off the table by selling to VCs, even before a product launches.

Some tech founders are bagging millions of dollars in early funding rounds as competition among investors drives up valuations for the hottest startups.

Partners at several top-tier venture firms, including Andreessen Horowitz, Founders Fund and Khosla Ventures, were quick to point out that stock sales can remove financial distractions for founders, such as college debt. But, they warn, these so-called secondary deals so early on can also stunt entrepreneurs by creating a false sense of success and blunting their drive.

“I passed on a company solely because the founders were planning to take significant liquidity [in its first round of funding]—before the company had a clear product-market fit,” said Geoff Lewis, a partner of Founders Fund, which has long been a big proponent of founders selling personal shares in later rounds. Mr. Lewis declined to name the startup but said it still managed to raise substantial capital because of investor interest.

“I believe founder liquidity should be linked to company success, not competitive VC dynamics,” he added.

Robinhood Markets Inc., maker of a financial-services app, raised $13 million in September for its first major financing from firms such as Index Ventures, entrepreneurs like Box Inc. Chief Executive Aaron Levie, and celebrities including rapper Snoop Dogg. The company’s co-founders, Vladamir Tenev, 27, and Biaju Bhatt, 29, former Stanford University roommates who previously built electronic trading platforms for New York financial firms, sold shares in the deal before the product’s public release earlier this December, according to people familiar with the matter.

When Snapchat Inc. raised an $80 million “Series B” round in June 2013—more than a year before the messaging app began selling advertising—co-founders Evan Spiegel, 24, and Bobby Murphy, 26, pocketed about $10 million apiece, according to people with knowledge of the deal. That round valued the company at about $800 million—more recently, investors have pegged Snapchat’s valuation at $10 billion and the app now has more than 100 million users.

But few startups can match Snapchat’s meteoric rise.

Secret’s path hasn’t gone as favorably. The anonymous messaging app quickly gained popularity when it launched in January. By August, shortly after it had raised capital at a $100 million valuation, the app was ranked in the top 100 of all U.S. apps, according to data from App Annie, a service that monitors the traction of mobile apps.

This month, however, Secret isn’t listed in App Annie’s top 1,500 ranking, suggesting the app has fallen out of favor with users. Last week, the company released a major overhaul of its app in an effort to reboot its popularity.

For years, it has been relatively easy for founders to sell stock before an initial public offering. However, shares are typically sold late in the startup’s life cycle, well after the company was clearing tens of millions of dollars. In 2010, a boom in so-called secondary shares gave rise to robust brokerages, where buyers and sellers traded stock in then-private companies like Facebook Inc. and Groupon Inc.

Nowadays, however, investors say there is so much money chasing deals that the action has trickled down to earlier rounds. As soon as a startup has the markings of a hit—no matter how young—everyone pours in, scrambling for their percentage points.

Investors “are fighting like drunken sailors,” says Gil Penchina, one of the most active investors on AngelList, a marketplace for investments that is open to established venture capitalists and well-heeled startup enthusiasts. Mr. Penchina says he isn’t concerned if an entrepreneur wants to take a couple hundred thousand dollars off the table, but several million can spell trouble. He notes, however, that often, it isn’t even the founders’ desire.

Instead, investors will lean on entrepreneurs to sell personal shares because they want to own more than 20% of the startup and a founder will do it to “keep the peace.”

While the notion of an entrepreneur getting rich long before the company makes its first dollar seems ludicrous outside of Silicon Valley, some founders and investors say it can make it easier to resist tempting acquisition offers. By selling so early, entrepreneurs are also taking on the risk that the shares they are unloading today could be worth far more down the road.

Joel Gascoigne, CEO of Buffer, recently raised a $3.5 million “Series A” round, of which $1 million went to the company’s coffers and $2.5 million went to Mr. Gascoigne, his co-founder and a handful of early employees. Mr. Gascoigne, who pays himself about $170,000 a year, said he wasn’t desperate for the money but it will help focus on building the company in the long-term.

Mr. Gascoigne said in an interview he has no plans to buy lavish goods with his cut, though he might use it to make investments in other startups. He also says he doesn’t feel guilty about selling shares because his company actually makes revenue and has been profitable for several months.

“So now I can go grocery shopping and not think about things too much,” he said.

Mr. Penchina, who has been investing in startups for many years, believes the industry should take some comfort in the idea that founders are still acting pretty rationally—when you consider how irrational this heated market can be.

“You could argue they only took $3 million, instead of $5 million,” Mr. Penchina said.