Energy stocks have been on a wild ride so far this year.  By the end of March, Devon EnergyMarathon Oil, and National Oilwell Varco (NYSE: NOV) were all up 19% or more. Energy mutual funds returned 10% in the first quarter, far and away the best sector performance, and well above the average fund return of 3%.

But May struck down much of those gains and, though things have begun to improve and the price of oil is climbing once again, many energy stocks remain down on the year.  As we cruise into Labor Day weekend, let’s break down the sector one more time

Majors
When I looked at this group three months ago, it was a grim picture indeed.  Oil majors were suffering from a poor economic outlook, and the lowest oil prices in months. Now that the price of oil has begun to rebound, so have our oil major stocks.

XOM Chart

XOM data by YCharts

It still hasn’t been a great 2012 for Big Oil, with only ExxonMobil and Chevron managing positive returns.  It is worth noting that it’s also true when you look at the group’s returns over the last five years. Exxon returned 2% over that time, while Chevron returned 27%.

Independents
This group tends to be more volatile than the majors: the highs are high and the lows are low.  Independent oil and gas companies follow the bounce of oil prices closely so, theoretically, our group should have popped nicely when oil prices rebounded. Three months ago, the stocks in this group were down between 7% and 30%.

APA Chart

APA data by YCharts

The group has recovered, particularly Chesapeake (NYSE: CHK), which has climbed nearly 17% over the last three months. This may be even more than investors had hoped for, given the year Aubrey McClendon’s company has had. Suncor (NYSE: SU) is the only company managing a positive return year to date -- and just barely.

Oilfield service companies
This is a group that I encourage investors to keep a close eye on, especially for long term investments.  Industry-leading service companies like Halliburton (NYSE: HAL) and Schlumberger will continue to have more and more opportunities in the future to do business where Big Oil cannot, specifically with national oil companies that aren’t interested in sharing crude resources with E&Ps.

SLB Chart

SLB data by YCharts

With the exception of Weatherford International (NYSE: WFT), which continues to fall, all of these companies have improved since the end of May. National Oilwell Varco made a particularly strong comeback; after being down 4.37%, it's now up over 7% on the year. It’s a long way off from its March level, but we’ve got another quarter left.

Midstream
The companies I compared in May all posted positive returns. In fact, it was the only subsector I looked at that was worth comparing to the S&P’s year-to-date performance.  At the time, three of the four midstream companies listed were beating the index.

EPD Chart

EPD data by YCharts

This time around, only two of our four outfits are up more than the S&P; however, all companies are posting gains on the year, and all but Enbridge are performing better than they did in May. Midstream is far and away the top performing energy subsector this year.

Midstream stocks hold one advantage over most other energy stocks, and that is that their business models are almost always built around fee-based contracts, and not tied to the price of commodities. It doesn't matter if the oil flowing through a pipeline is worth $1 or $100, it will cost the same to transport it. The pipelines make more money as volumes increase across their systems. Right now, there is plenty of demand to increase North American midstream infrastructure, which means that these stocks will remain solid investments for quite some time.

Typically organized as master limited partnerships, midstream stocks also offer great yields. Though there is a little extra paperwork come tax time, yields are often 5% or greater.

Foolish takeaway
Generous dividends create long-term wealth, but midstream companies aren't the only great dividend stocks out there. For a look at some other great dividend ideas, check out the Fool's special free report detailing nine rock-solid dividends. Be sure to look over this outstanding report now, it will only be available for a limited time.