In today's choppy market, many investors are seeking out the relative safety of oil and gas stocks. And it's no wonder. Most energy stocks have a modest valuation and a decent dividend yield -- offering solid value to investors fleeing the lofty valuations and dividend-free zone of the high-growth technology sector.

So for investors looking to put money to work in the sector, let's look closer at two of the somewhat lesser-known names: Murphy Oil (MUR -0.52%) and Devon Energy (DVN -0.61%).

An offshore oil rig with yellow-painted steel on a calm, blue sea.

Image source: Getty Images.

1. Murphy Oil 

Murphy Oil is an independent oil and gas producer founded in 1950 and headquartered in Houston, Texas. Murphy's operations are based across three regions: Western Canada, Texas, and The Gulf of Mexico. The bulk of Murphy's production (45%) and revenues (61%) come from its offshore wells in the Gulf of Mexico.

With a market cap of $5.3 billion, Murphy is modest in size and conservative in vision. One of its key strategic priorities for 2022 is to reduce its debt. To this end, the company has already redeemed $200 million of debt scheduled to come due in June, and it has increased its debt reduction goal for 2022 to between $600 million to $650 million. Murphy's total debt now stands at $3.4 billion. With free cash flow of $847 million over the last twelve months, management's debt reduction goals look achievable.

Murphy's focus on debt repayment is already having an effect. One credit rating agency, Moody's, has already boosted Murphy's credit rating, while another, S&P Global, has changed its credit outlook for Murphy to positive -- often a precursor to a credit rating upgrade.

The downside to Murphy's focus on debt reduction is that its dividend yield remains a lackluster 1.99% despite a 40% increase earlier this year.

2. Devon Energy 

Devon Energy, based in Oklahoma City, is also an independent oil and gas producer. However, with a market cap of $46 billion, it's roughly 10 times the size of Murphy. Devon's oil and gas wells are spread throughout several American states: North Dakota, Wyoming, Oklahoma, Texas, and New Mexico. However, more than two-thirds of its production comes from the Delaware shale, located in West Texas and New Mexico.

DVN Profit Margin Chart.

DVN Profit Margin data by YCharts.

Devon's high-margin wells in the region have fueled the company's recent performance. As a result, Devon declared a fixed-plus-variable dividend of $1.27 in the first quarter (its dividend yield stands at 7.27%) and expanded its share buyback program to $2.0 billion.

Which is the better buy, Devon or Murphy?

With oil and gas prices soaring, both companies have seen their stock prices rip higher. But in the head-to-head comparison, Devon has come out on top. 

DVN Chart.

DVN data by YCharts.

A $10,000 investment in Devon shares one year ago would now be worth over $28,000, while the same investment in Murphy would be worth about $17,500. With oil still trading above $100/barrel and natural gas hovering near multi-year highs, both companies appear well placed to thrive throughout the rest of 2022. 

Yet, in the long term, I prefer Devon to Murphy. Its sizable dividend yield (7.27%) and share buyback program provide downside protection if oil and gas prices pull back from current levels -- a growing possibility given the increasing likelihood of a recession.