It's an age-old challenge for investors -- everybody wants to retire a millionaire, but overly aggressive efforts to build a million-dollar portfolio often make reaching that goal less likely. The trick? Buying the right stocks and then simply leaving them alone, allowing time to do the bulk of the heavy lifting.

That's easier said than done. A wide swath of the financial media encourages investors to chase hot stocks rather than buy and hold quality picks. Being passive doesn't always feel right.

As most truly successful long-term investors can attest, however, you're probably not going to out-trade the market. You're better served by just riding the market's long-term bullish tide.

To this end, here's a closer look at three companies that can help your retirement fund reach the $1 million mark and stocks you can comfortably hold for decades. Their products and services will always be in demand.

1. Bank of America

There's nothing particularly remarkable about Bank of America (BAC -0.21%) other than its enormous size. But that's kind of the point. Some banks that venture into more creative opportunities end up regretting it. SVB Financial's Silicon Valley Bank and Signature Bank come to mind. Bank of America tends to stay in the traditional banking lanes. That's how it's survived -- and even thrived -- for decades now.

That being said, don't confuse being boring and predictable with being unfruitful for shareholders. Bank of America stock is trading at about twice its price from 10 years ago, and higher to the tune of 1,000% over the past 40 years. And that doesn't include the value of the dividends it has paid.

And those dividends, by the way, have grown steadily over the course of the past decade, from $0.03 per share per quarter back in early 2014 to $0.24 per share per quarter now.

Veteran investors may recall the fallout from 2008's subprime mortgage crisis hit banks hard, and BofA was no exception. Not only did the situation force the bank to cut its previously generous dividend payment down to a nominal $0.01 per share for several years, Bank of America shares are still priced below their pre-crisis peak. It's a reasonable argument for not owning a stake in this (or any other) bank ever again.

Don't jump to long-term conclusions about an industry based on temporary, extraordinary circumstances, though. Yes, banks should have known better than to extend so many risky loans facilitating purchases of overpriced homes. The world still needs banks more than it doesn't, however, and as long as there's money, there's a profit to be earned by being in the banking business. Bank of America's sheer size keeps it positioned to win at least its fair share of this business.

2. Microsoft

To simply call Microsoft (MSFT 1.82%) a software company is a bit of an understatement. It's arguably the software company. Numbers from GlobalStats indicate Microsoft's various Windows operating systems are installed on 73% of the planet's computers. Even if the company didn't offer any other software, it would still be one of the planet's best-positioned gatekeepers to the internet. Other software companies still code their software to first and foremost work with Windows.

Microsoft, of course, doesn't stop at operating systems. Its office-productivity software like Word, Excel, and Outlook accounts for about half of this market, according to numbers from technology market research outfit Enlyft. It's not just its dominance of all things PC that makes Microsoft a name worth owning for the long haul, either. The software giant is a key player in the cloud computing market as well. Synergy Research Group reports Microsoft's share of the global cloud infrastructure market grew to 24% last quarter, up from only 15% as of the end of 2018. That not only makes it the fastest-growing cloud computing operation over that time frame but puts it within reach of Amazon's market-leading 31% share. Then there are Microsoft's Xbox video gaming brand, LinkedIn, search engine Bing, a few artificial intelligence projects, and a bunch of other business services you might not even realize Microsoft offers.

Sure, the company's highest-growth days are likely in the past. Its revenue model is also evolving. Much of its software is now rented rather than outright purchased, which supports more predictable revenue, but at growth rates below those seen during the company's heyday in the 1990s and early 2000s.

Take a step back and look at the bigger picture, though. All of its products and services are going to be just as necessary a few decades from now as they are now. By offering access to its tools and tech via affordable monthly subscriptions, Microsoft is ensuring it will remain a market leader well into the future.

3. Mastercard

Last but not least, add credit card middleman Mastercard (MA 0.07%) to your list of stocks to buy and hold if you'd like a shot at retiring with $1 million.

You know the company. In fact, if you have any credit cards at all, then odds are good you're a customer. Roughly 43% of adults in the United States carry a Mastercard card. Globally, it processes a quarter of credit card transactions. The company handled nearly 171 billion transactions last year, facilitating the purchase of more than $7.3 trillion worth of goods and services. That translated into $25.1 billion worth of 2023 revenue for Mastercard, and net income of $11.2 billion.

Yes, credit card networks are incredibly profitable. They always have been -- a detail too many investors seem to overlook. But what does the future hold for Mastercard's business?

It's not an unfair question to ask. Most of the company's potential growth has already been tapped, after all. Insider Intelligence reports that debit cards are now used about as often as cash is on a worldwide basis, with credit cards not being far behind. Digital wallets are in the mix as well. Cash is even less frequently used within the United States. On balance, the now-relatively modest overall use of cash seemingly limits how much new business any credit card company will be able to win going forward.

Mastercard has an edge when it comes to setting itself up for continued growth, however. That's its willingness and ability to innovate -- including innovations that don't directly drive more revenue-bearing card transactions.

As an example, did you know that Mastercard operates a consulting business that helps merchants get a better handle on how they can adapt to the ongoing evolution of AI? The company is also in the music business. Its Artist Accelerator arm is helping artists use artificial intelligence and other music-making digital tools -- including some made by Mastercard itself -- to create songs. And, just last month, the company announced a partnership with Indian healthcare tech company Remedinet aimed at streamlining cashless payments being made by insurers to hospitals.

None of these efforts will inspire consumers to whip out their cards any more than they already are. All of these initiatives, however, ensure Mastercard is positioned to capitalize on whatever the future holds for the payments business.