Tech stocks have soared over the last 12 months, with the Nasdaq-100 Technology Sector up 58% since February 2023.

Wall Street has rallied behind budding industries like artificial intelligence (AI) and cloud computing, which have massive potential over the next decade. The AI market, on its own, is projected to have a compound annual growth rate (CAGR) of 37% until at least 2030.That trajectory would see the sector hit a valuation nearing $2 trillion before the end of the decade.

Meanwhile, the cloud market has a CAGR of about 18%, bolstered by increased demand for AI services.

As a result, now is an excellent time to consider expanding your portfolio with companies most likely to benefit from the tailwinds of these industries over the long term.

So, want to get richer? Here are two top stocks to buy and hold forever.

1. Advanced Micro Devices

As a leading chipmaker, Advanced Micro Devices (AMD 2.37%) is one of the best ways to invest in tech. The company powers products across the industry, supplying chips for video game consoles, cloud platforms, laptops, AI models, and custom-built PCs.

Its most promising venture in the last year has easily been its investment in AI. AMD's stock has risen 20% year to date, almost completely based on investors' excitement over its prospects in the burgeoning market.

AI exploded in 2023, causing demand for high-powered chips like graphics processing units (GPUs) to skyrocket. Nvidia got a head start in the race, snapping up an estimated 80% to 95% market share in AI chips. But AMD is moving to challenge Nvidia's dominance and take its slice of the $200 billion industry.

Last December, AMD unveiled its MI300X AI GPU, designed specifically to provide an alternative to Nvidia's products. The new chip has already caught the attention of some of tech's most prominent players, signing on Microsoft and Meta as clients.

AMD posted 2023 fourth-quarter earnings on Jan. 30. Revenue for the period rose 10% year over year to $6 billion, beating analysts' expectations by about $60 million. The company's AI-focused data center segment posted revenue growth of 38%. Meanwhile, improvements in the PC market boosted AMD's client segment by 65% year over year.

The company has a solid outlook over the long term, and earnings-per-share (EPS) estimates seem to support this.

AMD EPS Estimates for 2 Fiscal Years Ahead Chart

Data by YCharts.

This chart shows EPS could hit just above $7 over the next two fiscal years. Multiplying this figure by the company's forward price-to-earnings ratio (P/E) of 49 yields a potential stock price of $352. If projections are correct, the stock could double by its fiscal 2026.

Though ambitious, the growth projection is based on reasonable financial forecasts, making it an excellent option for anyone looking to make a long-haul investment in tech.

2. Alphabet

While AMD is crushing it in hardware, Alphabet (GOOG 9.96%) (GOOGL 10.22%) is a king in software, with potent brands like Android, YouTube, Chrome, and the many products under Google.

Over the last five years, the company's annual revenue has climbed 90% to $307 billion, while operating income has risen 135% to $84 billion.

Alphabet has built a lucrative digital advertising business, which has become its bread and butter. With more than 80% of the search-engine market and supremacy in online video sharing and smartphone operating systems, the tech company has almost endless opportunities for ad revenue.

In Alphabet's most recent quarter (the fourth quarter of 2023), revenue increased by more than 13% year over year, beating expectations by $1 billion. Ad revenue slightly missed expectations in the quarter. However, its AI-focused Google Cloud segment posted revenue growth of 26% to $9 billion. Meanwhile, Google Cloud's operating income reached $864 million, versus the $186 million in losses it reported in the year-ago period.

MSFT PE Ratio (Forward) Chart

Data by YCharts.

Like most tech companies, Alphabet is investing heavily in AI. Its biggest rivals in the industry are currently Microsoft and Amazon, with both gradually expanding their AI cloud offerings. Alphabet isn't as far into its AI venture as its competitors, but the chart above shows its stock is trading at a significantly better value.

The Google parent's forward P/E and price-to-free-cash-flow (P/FCF) are considerably lower than the same metrics for Microsoft and Amazon, making Alphabet's stock a bargain by comparison.

With a long list of potent brands, stellar financial growth, and an expanding role in AI, Alphabet is a no-brainer to buy now and hold forever.