Top oil and natural gas stocks are trading near multiyear lows. Investors' interest in the sector is at its lowest point in decades. Some believe that the era of these fossil fuels, just like that of coal, is coming to an end. Does that mean that you should get rid of your oil stocks?

Rock-bottom stock prices

Measured over nearly any time frame from the past 15 years, oil and natural gas stocks are now in the red. From upstream heavyweight ConocoPhillips (NYSE:COP) to top downstream player Phillips 66 (NYSE:PSX), the gloom in the sector hasn't left any segment untouched. This is also true for integrated giants ExxonMobil (NYSE:XOM) and Chevron (NYSE:CVX).

XOM Chart

XOM data by YCharts

XOM Chart

XOM data by YCharts

Weary investors just want some relief, and some no doubt feel the best way to get it is to sell their holdings in the sector. If you feel that way, though, hold on.

First and foremost, such a step is squarely against the fundamental investing principle of "buy low, sell high." If anything, the current low prices provide an entry opportunity, not an exit point. But what if these stocks continue to fall, and oil and natural gas never regain their former status in the global energy market? There is ample evidence that suggests that events won't follow that pessimistic scenario.

Oil prices

In the third quarter, prices for U.S. benchmark West Texas Intermediate crude oil averaged $40.93, up significantly from their average of $27.96 in the second quarter. Sure, the prices aren't at levels that allow oil companies to churn out huge profits. However, they have improved, reflecting the recovery in demand that took place after shelter-at-place mandates were relaxed. That's a good sign for oil companies.

Portrait of a Worried Mature Man With Laptop Holding Cup.

Image source: Getty Images.

ConocoPhillips' preliminary third-quarter results reflect those positive developments in the oil markets. Based on its estimates, the company's oil-equivalent production in Q3 rose 8% from Q2. Though it's still down 20% compared to the year-ago quarter, the company fully restored production in the U.S. and Canada by the end of the third quarter. That has given ConocoPhillips the confidence  to resume its share repurchase program.

It's difficult to predict where oil prices are headed, but it's widely believed that they may not return to the high levels they reached prior to 2014. If crude prices indeed remain in the neighborhood of current levels, several smaller, higher-cost producers may go out of business. However, those companies that have the lowest production costs and the least leverage should survive and thrive over the long run. ExxonMobil and Chevron fall into that second category.

XOM Financial Debt to Equity (Quarterly) Chart

XOM Financial Debt to Equity (Quarterly) data by YCharts

As the above graph shows, both ExxonMobil and Chevron are less leveraged than peers BP and Royal Dutch Shell.

The future of oil and gas

The biggest concern for oil sector investors today is that, eventually, renewable fuels may largely displace oil and natural gas as energy sources. This fear is not baseless. However, such a transition is not going to happen overnight. The International Energy Agency projects that global oil demand will keep rising for at least the next 20 years under policies in effect currently. Should the entire world make a more concerted effort to transform their energy systems with an eye to combating climate change and environmental degradation, oil demand would peak more quickly. This doesn't seem to be happening at the moment -- but even if efforts in that direction intensify from here, oil and gas will continue to supply a major chunk of the world's energy needs for decades to come.

With the planet's population growing and living standards rising in less-developed nations, global energy demand will keep increasing. It will be met by a combination of sources, including fossil fuels and renewables. We can, therefore, consider it likely that top oil and natural gas companies will continue to generate steady cash flows for years to come.

Dividend income

Finally, oil stocks at the moment feature particularly attractive dividend yields. Given the improvements in the oil market, the payouts of Chevron, ConocoPhillips, and Phillips 66 look safe at the moment. ExxonMobil has publicly committed to maintaining its dividend at its current level, though that may not be the best use of its capital. Moreover, holding steady on the payout may become more difficult as lower gas prices and tighter refining margins are expected to hit ExxonMobil's Q3 results.

XOM Dividend Yield Chart

XOM Dividend Yield data by YCharts

Oil and natural gas companies may not repeat the phenomenal earnings growth that they produced during the shale boom. However, the expectation for a longer-term rise in demand means the outlook for top oil companies is upbeat. Companies are adapting to lower oil prices by focusing on reducing production costs. At the same time, the impacts of the pandemic should continue to wane. Top oil companies have a fair chance of coming out of the current mess. In short, selling your oil stocks may not be the best idea today.