Blood-testing firm Theranos Inc. laid off most of its remaining workforce in a last-ditch effort to preserve cash and avert bankruptcy for a few more months, according to people familiar with the matter.

Tuesday’s layoffs take the company’s head count from about 125 employees to two dozen or fewer, according to the people familiar with the matter. As recently as late 2015, Theranos had about 800 employees.

Elizabeth Holmes, the Silicon Valley firm’s founder and chief executive officer, announced the layoffs at an all-employee meeting at Theranos’s offices in Newark, Calif., less than a month after settling civil fraud charges with the Securities and Exchange Commission.

Under the SEC settlement, she was forced to relinquish her voting control over the company she founded 15 years ago as a 19-year-old Stanford dropout, give back a big chunk of her stock and pay a $500,000 penalty. She also agreed to be barred from serving as an officer or director in a public company for 10 years.

Neither Ms. Holmes nor Theranos admitted or denied wrongdoing. Ms. Holmes and her former No. 2 executive, Sunny Balwani, remain under criminal investigation by the U.S. attorney’s office in San Francisco, according to people familiar with the matter. Mr. Balwani has denied the SEC fraud charges, filed in a California federal court, and hasn’t settled with the agency.