Image source: Getty Images.

Few companies have been as successful over the past 100 years as Johnson & Johnson (JNJ 0.29%). And few companies have been as successful over the past 10 years as Gilead Sciences (GILD 0.12%). But which of these two healthcare stocks is more likely to be successful over the next decade or century? Here's how Gilead and J&J compare.

The case for Gilead Sciences

If you had looked at Gilead Sciences at the beginning of the 21st century, you would have been impressed by a biotech that developed game-changing HIV drugs. Fast-forward to today, and the bigger story now is in other indications.

Gilead radically transformed itself back in 2011 when it acquired Pharmasset for $11 billion. At the time, many thought the big biotech was crazy to spend that much, but the move turned out to be much closer to genius than madness. Gilead's hepatitis C franchise, built upon the drugs picked up in the Pharmasset acquisition, generated combined revenue of over $19 billion in 2015 and $12.4 billion the previous year.

The bad news for Gilead is that its hepatitis C sales appear to have already peaked. The good news is that the biotech's pipeline and its ability to make deals could enable yet another transformation.

While Gilead's pipeline includes HIV and hep C candidates, the company is attempting to branch out into other lucrative indications. I particularly like Gilead's focus on nonalcoholic steatohepatitis (NASH). The global NASH drug market size could top $35 billion by 2025. Gilead looks ready to stake its claim in that market, with six clinical studies in progress targeting the indication.

Gilead's pipeline also includes several other promising candidates. Eleclazine is in a phase 3 study targeting treatment of rare heart disease long QT-3 syndrome. JAK1 inhibitor filgotinib is in two phase 2 studies for treatment of Crohn's disease and rheumatoid arthritis. Three late-stage studies are in progress for cancer candidates, including potential myelofibrosis drug momelotinib. And those are just a select few of the more than 30 clinical studies that Gilead has under way. 

Even better, Gilead is in a great position to bolster the pipeline even more. The biotech reported $8.75 billion in cash, cash equivalents, and marketable securities at the end of June. Despite the slowing hep C sales, Gilead still generated over $7 billion in earnings in the first half of this year. Some of its earnings will go toward paying dividends and buying back shares, but I doubt Gilead would shy away from a good investment in building its pipeline.

Speaking of dividends, Gilead's dividend yield now stands at 2.58%, and it should have no problem increasing its payout in the future. With the biotech's stock trading at a low six times forward earnings, investors won't find too many biotech bargains with such a solid pipeline.

The case for Johnson & Johnson

Johnson & Johnson's reach expands into nearly every major area of healthcare. From consumer products like Band-Aids to blockbuster drugs like Stelara to medical devices like artificial hip implants, J&J is there.

For investors, the key word that describes Johnson & Johnson is "consistency." The company has been around since 1886. J&J has racked up 32 consecutive years of adjusted earnings increases. It's one of the premier dividend stocks, with a 54-year streak of raising its payout and a current yield of 2.72%.

Johnson & Johnson's current success is largely driven by its pharmaceutical business segment. Pharmaceutical sales in the first half of 2016 accounted for nearly half of the company's total revenue. While the consumer and medical-devices segments saw sales slip versus the prior-year period, pharmaceutical sales increased by 7.4% year over year.

The top drugs behind J&J's current growth include Stelara and Xarelto. Both drugs could also help the company continue to grow. Stelara is in two late-stage studies, one for treating ulcerative colitis and another for treating axial spondylitis. Xarelto is in four late-stage cardiovascular studies.

While Gilead's pipeline includes over 30 clinical studies, J&J's pipeline has over 30 late-stage studies. Some of those studies involve current drugs on the market like Stelara and Xarelto, but several feature new candidates.

Johnson & Johnson is in even better shape to forge partnerships and deals than Gilead is. The company reported cash, cash equivalents, and marketable securities totaling $42.6 billion at the end of June. J&J's earnings for the first half of the year were nearly $8.5 billion. 

Better buy

I could easily go with either of these stocks as the better pick. Gilead Sciences is dirt cheap in my opinion, especially considering the biotech's pipeline prospects. I truly don't think Gilead's best days are behind it, despite its current hepatitis C challenges.

However, investing is all about risk versus reward. I think J&J has less risk than most healthcare stocks because of its diversification into multiple areas. With its robust pipeline and impeccable dividend history, I also think the stock should reward investors with growth and income.

Gilead Sciences is a good stock to buy, in my view. The better buy for the long run, though, looks like Johnson & Johnson. I suspect that 100 years from now J&J will still be alive and thriving.