Concentrating firepower on hard-to-treat viruses made Gilead Sciences (GILD -0.57%) one of the world's most profitable companies in recent years. In fact, the biotech's cash flows topped Johnson & Johnson's (JNJ 1.11%) two years in a row.  

Eclipsing the 130-year-old conglomerate is no small feat. Johnson & Johnson is one of the largest publicly traded companies on the planet. Although size is often an advantage, moving such a big needle forward isn't easy. With this in mind, let's look at challenges facing both companies to see which stock is the better buy now.

Random patient sitting on top of a giant two-toned capsule trying to make up her mind.

Image source: Getty Images.

Fun while it lasted

In terms of free cash flow, Gilead Sciences actually beat J&J last year and the year before largely due to exploding sales of its hepatitis C virus (HCV) treatments. Although the company is still the leader in this space, it's gotten a bit crowded lately. As a result, it expects total product sales to fall from $30.0 billion last year to between $22.5 billion and $24.5 billion this year.

While the HCV franchise finds a bottom, recently launched HIV treatments are helping to offset the losses. This virus still requires lifelong treatment, and Gilead's tenofovir alafenamide-based antivirals are far easier to tolerate than previous treatments. This advantage helped annual non-HCV antiviral sales climb 16% higher last year to $12.9 billion.

Gilead Sciences has a fairly robust pipeline with over a dozen different new drug candidates in mid- to late-stage clinical trials. Another next-generation HIV combo and the company's potential first autoimmune disease drug are approaching the finish line.

In earlier stages of development, you'll find a handful of candidates aimed at non-alcoholic steatohepatitis. The growing epidemic affects millions of Americans, but there's a dearth of effective treatment options. Success here would help return the company to growth, but for now, all eyes are on its growing cash pile.

Gilead Sciences finished 2016 with about $32.4 billion in cash and equivalents on its balance sheet. That's enough to bolster its portfolio with one huge acquisition or several smaller ones. Management has been characteristically cagey about how it intends to employ its liquid capital, although comments suggest a desire to boost the company's minor oncology presence.

Johnson & Johnson CEO Alan Gorsky

Johnson & Johnson CEO Alan Gorsky. Image source: Johnson & Johnson.

Ups and downs

Johnson & Johnson still derives a majority of its total revenue from its consumer and medical device segments, while a successful pharmaceutical segment pushes its enormous needle forward. In fact, the company's pharmaceutical segment was the only one that moved ahead last year.

Luckily, it looks like pharmaceutical revenue will continue to move in the right direction. Unlike Gilead, sales of J&J's most successful drug, Remicade, are still climbing. Last year, the anti-inflammatory blockbuster contributed $6.97 billion to the top line, about 6.2% more than the previous year.

Remicade has been fighting biosimilar competition in the EU for years, and another version of the drug, to be marketed by Pfizer in the U.S., earned approval from the Food and Drug Administration in April. Unlike Gilead, J&J's diverse product lineup contains several recent launches that could more than offset Remicade losses. In oncology, sales of blood cancer treatment Imbruvica jumped 82% last year to $1.3 billion.

Johnson & Johnson's share of Imbruvica sales is expected to top out at around $5 billion per year at its peak. The company also sports a more recently launched multiple myeloma therapy that's rapidly gaining popularity called Darzalex. In its first full year after earning FDA approval, the drug contributed $572 million to J&J's top line. Darzalex recently earned approval to treat a much larger group of patients that could help its annual sales outshine Imbruvica, although it's still early.

What you get vs. what you pay

Gilead's recent slide makes Johnson & Johnson look like an obvious winner until you consider Gilead's ultra-low valuation. Fear that Gilead's HCV sales could slide much further have beaten the stock into submission, and perhaps too far. By market cap, J&J is worth about 3.6 more than Gilead. In terms of free cash flow generation, though, they're nearly tied.

GILD Market Cap Chart

GILD Market Cap data by YCharts.

Long-term investors like to think of free cash flow as profit a company can use to pay debts, make acquisitions, or distribute to shareholders. Both companies are famous for distributing profits to shareholders, but you might see more from Gilead in the years ahead. If we invert the price-to-free cash flow multiple, every $100 used to purchase Gilead Sciences stock at this price comes with $17 each year in free cash flow, assuming profits remain flat.

On the same yardstick, J&J shares offer about $4.48 for every $100 invested, which isn't bad. After decades of consistent earnings growth and a 55-year streak of consecutive annual dividend raises, you can quite reasonably expect to earn the same amount or more throughout your retirement years.

I wouldn't criticize anyone for choosing J&J over Gilead right now. Hepatitis C sales were expected to cool off, but the severity has been surprising. At recent prices, though, it looks like the company's profits could fall by more than half and you'd still come out ahead in the long run. That makes Gilead Sciences the better buy right now.