There are some stocks that should form the backbone of any strong portfolio, stocks that you buy and hold until retirement or forever. Even during uncertain times, these stocks are good buys that, over the very long term, should outperform the rest of the market. 

Apple (AAPL -0.06%), Advanced Micro Devices (AMD 1.22%), and Microsoft (MSFT -3.18%) are three such stocks. Companies that you can be confident will weather any market conditions and come out ahead over time. Let's find out a bit more about them.

1. Apple

Apple is one of the most dependable companies on the planet. It may not be the first to launch a product, but when it does, you can be sure that Apple's version will be a hit. Historically, the two biggest examples of Apple's success in defining a category of products were the iPhone and iPad. Smartphones and tablets are part of everyday life in 2022, but neither category would be where it is today without the immense input of Apple. 

In recent years, the company continued this success with other categories, such as the Apple Watch and the exceedingly successful AirPod lineup. Smartwatches and wireless headphones are now dominated by Apple, with the Apple Watch making up 30.1% of the smartwatch market last year and its wireless headphones business comprising AirPods and Beats accounting for nearly 50% of the U.S. market.

Looking ahead, Apple will reportedly release its long-awaited Augmented Reality headset next year. The company's AR headset is another opportunity for Apple to dominate an entirely new category of products. According to Grand View Research, the AR market was worth over $25 billion last year, and analysts expect it to grow by nearly 41% annually from 2022 to 2030. Apple is in a prime position to drive that growth. 

With its track record, there's no reason to doubt that Apple will be able to pull off its trademark product consistency and success going forward and, therefore, no reason to worry about holding onto Apple stock forever. 

2. Advanced Micro Devices

Advanced Micro Devices stock has soared since it successfully launched its Ryzen CPU platform in 2017, going from under $2 a share in 2015 to $158 in 2021. Prior to the release of Ryzen, the company was struggling to compete with Intel in the consumer processor market. However, after nearly five years of Ryzen processors, AMD hit a record-high market share for its CPUs, with AMD processors making up 25.6% of the overall market at the end of 2021. The figure beat its previous record of 25.3% market share set in 2006.

Moreover, AMD has had Intel on the back foot for the past few years. Intel had been content to milk its market-leading position while AMD struggled, with Intel releasing minor processor upgrades and speed bumps. To the point where Apple, Intel's biggest single customer, dropped the company altogether in 2020, opting to make its own chips for its Mac lineup of desktop and laptop computers.

Meanwhile, AMD started releasing increasingly impressive products that helped it recapture market share from Intel and lock in a dedicated following of tech enthusiasts. Its decision to support the AM4 motherboard socket for multiple generations of processors meant consumers could upgrade their CPUs without the costly addition of a new motherboard, earning the company much-needed consumer loyalty and helping to grow its market share.

AMD has a bright future with the recent release of its new generation of processors, along with the first new CPU socket since 2016 and its upcoming launch of the Radeon 7000 series of graphics cards. With a current share price of $57 and a target price of just under $97, there's plenty of growth in the company to hold its stock for the very long term.

3. Microsoft

Microsoft maintained its dominance over the consumer PC market despite threats from other operating systems, as Alphabet's Chrome OS and Mac OS have slowly chipped away at the company's market share. Although Windows's market share fell from 85.4% in 2019 to 80.5% in 2020, the combined strength of Apple and Alphabet isn't enough to make a real dent in the commanding lead Microsoft enjoys in the PC space.

Microsoft leveraged its share of the PC market by growing its Xbox brand, investing in related services such as LinkedIn, and venturing into developing its own hardware with the Surface line that just celebrated its 10th anniversary. Today's Microsoft is a diversified powerhouse that succeeds more often than it fails.

Looking ahead, Microsoft is at the forefront of gaming. The company also leveraged its Xbox brand into creating the successful Xbox Game Pass service and rolling that into Xbox Cloud Gaming. Now that Alphabet has thrown in the cloud gaming towel, Microsoft is the biggest player in the cloud gaming space, which brings games to players anywhere with internet access. Much like Netflix brought movie streaming to the world, Microsoft is delivering game streaming, which could be the future of the $195 billion gaming market.