A great year for investors will soon come to an end. The stock market has delivered exceptional gains over the last 12 months, with the so-called "Magnificent Seven" stocks leading the way.

What should investors do now? Keep buying great stocks. And there are plenty from which to choose. Here are three top stocks to buy hand over fist before the end of 2023.

1. Alphabet

Alphabet (GOOG 9.96%) (GOOGL 10.22%) ranks as one of those "Magnificent Seven" stocks that skyrocketed this year. Shares of the technology giant have soared nearly 60% higher thanks in large part to a generative AI boom.

I think that Alphabet can keep this momentum going in the new year. It seems likely that the U.S. economy will avoid a recession. Inflation is moderating. The Federal Reserve expects that interest rate cuts will be on the way. That's good news for Alphabet because it should mean that advertising revenue will remain strong.

Look for Gemini Ultra to make a big splash in 2024. Alphabet announced earlier this month that the new AI model is the first to beat human experts on the MMLU (massive multitask language understanding) test, which includes 57 subjects such as history, math, and physics.

Some investors were concerned about Google Cloud's slowing growth rate in the third quarter of 2023. Gemini Ultra appears to be exactly what the cloud platform needs to win new customers and hold onto existing customers who might have otherwise considered using OpenAI's GPT-4. The new AI model just might be a game-changer for Alphabet -- and it's rolling out to customers early next year.

2. D.R. Horton

Huge gains this year haven't been limited only to tech stocks. Shares of homebuilder D.R. Horton (DHI 0.78%) have vaulted nearly 70% higher in 2023. The stock has more room to run next year, in my view.

Those potential interest rate cuts I mentioned earlier could provide a nice tailwind for D.R. Horton. Lower rates should translate to more people in the market for houses. As the company's chairman Donald Horton has said, "More people choose D.R. Horton to build their home than any other builder in the United States."

Even without rate cuts, D.R. Horton's business should continue to boom. There's a significant housing shortage in the U.S. The only way to alleviate the problem is for new houses to be built.

What I especially like about D.R. Horton is that it's still a bargain even after its impressive gains this year. The stock's price-to-earnings-to-growth (PEG) ratio is a low 0.65. Any PEG ratio below 1.0 is considered to be an attractive valuation.

3. Vertex Pharmaceuticals

Vertex Pharmaceuticals (VRTX -0.06%) stands out as another big winner this year. Shares of the biopharmaceutical company have jumped nearly 40%. I predict that more good news will be on the way for Vertex.

The big biotech expects to report results from late-stage studies of its vanzacaftor triple-drug combo in treating cystic fibrosis (CF) in early 2024. It also should soon announce results from late-stage studies of VX-548 in treating moderate-to-severe acute pain. While it's possible that the data could be disappointing, I think it's more likely that Vertex will have positive results for both pipeline candidates.

Vertex and its partner, CRISPR Therapeutics, have already won U.S. approval for Casgevy (exa-cel) in treating sickle cell disease. The Food and Drug Administration (FDA) is scheduled to make its approval decision for the gene-editing therapy in treating another rare blood disorder, transfusion-dependent beta-thalassemia, by March 30, 2024. I expect another thumbs-up from the FDA.

Those are the major potential near-term catalysts for Vertex. But the company also expects to advance inaxaplin into a phase 3 study in the first quarter of 2024 in treating APOL1-mediated kidney disease (AMKD). Vertex thinks that it could have a path to accelerated approval with its interim analysis from the study at 48 weeks of treatment. Importantly, AMKD could present a market opportunity that's bigger than CF, the company's current primary focus.