Healthcare stocks have been getting crushed as the sector rolls out its second-quarter earnings. This spike in volatility nonetheless may represent a compelling buying opportunity for investors with a long-term outlook.

Source: Flickr via user NEC Corporation of America

After all, the sector contains many companies that not only pay dividends but offer investors high growth prospects for decades to come due to greater access to healthcare from Obamacare and the surge in overall demand stemming from the estimated 78 million baby boomers reaching retirement age right now. 

Given the diversity of investing options, though, how does one go about selecting healthcare stocks to stash away for the long haul? My recommendation is to go with companies that have proven to be on the side of shareholders by committing to share buybacks, dividend increases, and deep clinical pipelines able to fuel long-term growth.

With this in mind, I think AbbVie (ABBV -0.33%), Gilead Sciences (GILD -2.65%), and Johnson & Johnson (JNJ -1.09%) stand out from the crowd. Here's a deeper look at why investors may want to consider buying these three healthcare giants to anchor their portfolios for the long haul. 

AbbVie is committed to high growth and shareholder rewards
The Street has been throwing shade at AbbVie for some time now, in part because of the looming patent expiration of its flagship anti-inflammatory drug Humira, but also because of the drugmaker's recent $21 billion acquisition of Pharmacyclics for its best-in-class blood cancer drug Imbruvica. Put simply, the Street simply isn't buying management's rosy double-digit growth projections in the years ahead because of Humira's patent problems, and it seems to think that AbbVie vastly overpaid for Pharmacyclics. That's why the stock is currently trading at a forward price-to-earnings ratio of only 13.6 -- well below the sector average. 

Source: AbbVie

A deeper look at AbbVie, though, shows a company committed to creating value for its shareholders. Since being spun-off from Abbott Laboratories in 2013, the drugmaker has raised its dividend by 28%, put a $10 billion share repurchase program in place, formed multiple partnerships to build out its pipeline, and aggressively developed its own clinical assets, leading to the regulatory approvals of key new drugs like Duopa and Viekira Pak, among others. The Imbruvica acquisition also puts the company's burgeoning hematology/oncology franchise on track to generate over $20 billion in peak sales, giving it more than enough potential to offset the expected revenue losses from Humira moving forward.

That being said, management has been working diligently to defend Humira against generic competition, with its multi-layered defense perhaps effectively extending the drug's exclusivity into the 2020s. Time will tell.  

Gilead Sciences is perhaps the biggest innovator in biotech
When it comes to changing the healthcare game altogether, look no further than Gilead. Not only has the biotech revolutionized the treatment of HIV with its single-tablet regimen drugs, but it also brought the first effective cure -- in many cases, at least -- to market for hepatitis C. The biotech now has its sights set on curing HIV and bringing important new medicines to bear for hard-to-treat blood cancers and liver diseases. 

This steady stream of ground-breaking innovation has led to an earnings bonanza for Gilead, which management promptly put to use by rewarding shareholders with a $15 billion increase in the company's share buyback program and instituting a dividend payment. With over $14 billion in the bank at last count, Gilead is also potentially gearing up to add to its embarrassment of riches by gobbling up other promising drugmakers -- or perhaps one large biotech or biopharma. All told, Gilead has a solid future ahead, making it a great stock to buy and never sell. 

J&J is the Rock of Gibraltar of healthcare stocks
Despite the negative impacts of both a strong dollar and fierce competition, J&J remains as solid as ever. Underneath the healthcare behemoth's dismal second-quarter numbers, in which its total revenue dipped by 8.8% from a year ago, we learned that once you take out the effects of currency translation, the company is actually still growing at a decent clip. Specifically, J&J posted a 6.7% increase in operational earnings (excluding foreign exchange) year-over-year for the three month period. That speaks to the company's resilience during a time of transition for its pharma product portfolio and an extremely unfavorable currency environment.

If we zoom out on the timescale, though, the real reason J&J is a stock to hold forever becomes apparent. J&J has raised its dividend for 53 consecutive years in a row, and increased its adjusted earnings per share for 31 straight years. So yes, J&J is facing some serious headwinds, with the introduction of generic Remicade, as well as with Olysio getting clobbered by newer hepatitis C drugs. But the company's vast pipeline and long history of bringing new game-changing products to market strongly suggest it will continue to be as steady as the Rock of Gibraltar going forward. 

Tying it altogether
There aren't many stocks that will truly give you peace of mind, but these three are probably the closest things you'll find, especially in the volatile healthcare sector. At the end of the day, they all have solid management teams that keep their shareholders' interest at the forefront of their minds, substantial and growing cash flows to support further increases in their dividends/share buyback programs, and, most importantly, first-rate clinical pipelines. In short, you may want to add all three stocks to your portfolio and hold them -- forever.