The great investor Warren Buffett has said his "favorite holding period is forever." While many professional and individual investors like to book a profit by selling shares, there are good reasons not to sell your winners. These include participating in the stock's further upside and delaying capital gains taxes.

There are few companies worthy of a forever holding period. Here are three that make the grade.

A thumb over a button that says long term

Image source: Getty Images.

1. Walmart

Walmart (WMT -1.75%) has a simple formula with a proven long-term success rate. Opening its first discount store nearly six decades ago, the retailer keeps costs low and passes these savings on to its customers. This sounds deceptively easy, but other companies have a hard time duplicating it. After all, keeping a lid on expenses is a core part of Walmart's culture. With annual revenue reaching $524 billion last year, the proposition and execution clearly have staying power.

While offering customers low prices will continue to propel the company forward, Walmart is not resting on its laurels. The company is reportedly taking on Amazon (NASDAQ: AMZN) through its own subscription service, Walmart+, charging $98 a year.

Walmart generates a prodigious amount of free cash and has returned some of this to shareholders via dividends. In fact, it has a nice record of annual dividend increases, hiking the payout since initiating a dividend in 1974. This makes the company a Dividend Aristocrat, an S&P 500 company that has raised its dividend for at least 25 straight years.

The company's cash flow can easily handle the dividend. Operating cash flow in fiscal 2020 (covering the period ended Jan. 31) was $25.3 billion. After subtracting $10.7 billion of capital expenditures, this left plenty to pay out $6 billion in dividends.

2. Costco

Costco (COST 1.01%) charges an annual membership fee to shop at its warehouse clubs, which sell a wide range of high-quality merchandise at low prices. The company also has a generous return policy, so that members have confidence in their purchases. This has worked well for the company during its nearly four-decade existence.

The model resonates strongly with people, which you can see by Costco's high membership renewal rate, a good sign that customers like the experience. In its fiscal third quarter (period ended May 10), it was 91% in the U.S. and Canada, and 88% globally. Meanwhile, Costco continues to sign up new members.

It has had a string of annual same-store sales' (comps) increases, and since fiscal 2015, its operating income has risen from $3.6 billion to $4.7 billion last year. With the value proposition Costco offers its members, there's no reason why the company can't continue producing strong results.

3. Johnson & Johnson

Admittedly, Johnson & Johnson's (JNJ 0.29%) second-quarter results slipped, with sales falling about 11% and earnings per share down nearly 35% versus a year ago. The coronavirus pandemic hurt the company's top and bottom lines since people put off surgeries and purchases of health and beauty products.

However, this is one weak quarter, which shouldn't dissuade you from owning this company, particularly given the extraordinary circumstances.

Johnson & Johnson's three segments are consumer, pharmaceutical, and medical devices. The first business sells well-known brands like Motrin, Tylenol, Listerine, and Band-Aid. The pharmaceutical segment sells drugs to treat things like rheumatoid arthritis, various cancers, heart issues, and diabetes. Lastly, the medical devices segment produces orthopedic and surgery products. In other words, people need these products no matter the state of the economy. Johnson & Johnson also has a strong global presence, with almost half of its sales coming from outside of the U.S.

This is another reliable dividend payer and a Dividend Aristocrat. In April, Johnson & Johnson raised its quarterly dividend by 6%, making it 58 consecutive years that the company has increased its payment.

Dividends are obviously important to the company, and it generates enough free cash flow (operating cash flow less capital expenditures) to make the payments. Last year's free cash flow was roughly $20 billion, and the company used about half for dividends.

These three companies have strong business models that continue to set them up for long-term success. Granted, buying and holding stocks is not the most exciting strategy, but doing so with these stocks should make you a happy investor at the end of the day.