One of the hottest healthcare stocks on the markets of late has been HIV-focused drugmaker Gilead Sciences (GILD 0.29%). Shares of Gilead are up a whopping 33% over just the past three months, dwarfing the S&P 500 and its 8% losses during that stretch. But with Gilead's shares now trading at their 52-week high, is it too late to buy the stock?

Here's a closer look at what's been behind Gilead's recent rally and whether or not its shares could still go higher.

Gilead is coming off a strong earnings report

On Oct. 27, Gilead released its third-quarter numbers. Sales for the period ended Sept. 30 came in at just over $7 billion and were down 5% year over year. However, that's mainly due to the decline in sales of Veklury, the company's COVID-19 treatment. When excluding that, the company's sales showed 11% growth, with Gilead's core HIV segment increasing by 7% to $4.5 billion.

The business did well in Q3 and as a result, Gilead has also increased its guidance for the year. For 2022, it now projects sales of $25.9 billion to $26.2 billion, up from its previous forecast of $24.5 billion to $25 billion. Earnings per share are also now expected to be at least $3.35 and as high as $3.55 (versus a prior forecast of $2.90 to $3.30). In light of such encouraging numbers, it's no surprise the stock soared 27% just last month.

Why it could go higher

In the long term, there's potential for the business to perform even better and for the stock to go higher. The company has a twice-yearly potential HIV treatment in lenacapavir that could be a game-changer for HIV patients who take pills every day. Investors won't have to wait long to find out if the Food and Drug Administration approves it as the drug has a PDFUA date of Dec. 27. Its peak annual sales could hit more than $4 billion.

Gilead also has a promising cancer treatment in Trodelvy that is just scratching the surface of its potential. Its revenue rose 78% last quarter to $180 million. But at its peak, analysts project it could top $2 billion in annual sales. With multiple growth catalysts in the works, it wouldn't be surprising if Gilead's stock were to reach new highs.

Why Gilead's stock isn't as expensive as it looks

At first glance, Gilead's stock may seem inflated, trading at 30 times its trailing earnings. But that includes a bad first-quarter result (for the period ended March 31) where research in process and a development impairment of $2.7 billion weighed down the company's bottom line. It was a non-recurring charge related to the assets the company acquired from Immunomedics in 2020.

When looking at forward earnings, Gilead trades at just 12 times profits. By comparison, the average healthcare stock trades at 16 times its future earnings.

Is Gilead a buy?

As well as Gilead's stock has performed this year, I wouldn't say that it has run out of steam. That may be the case in the short term, but between its modest valuation and multiple growth catalysts that could send its sales and profits higher, this is a stock that could still be a good buy right now.

As a bonus, it also pays investors an above-average dividend yield of 3.6% -- twice that of the S&P 500. For long-term investors, Gilead is a solid stock to buy and hold.