After losing ground for years, the US middle class is slowly clawing its way back.

In 38 states, a larger share of households were "middle class" in 2016 than in 2013, according to a new Stateline analysis. This group, which is defined as earning between two-thirds and twice the state's size-adjusted median household income, had contracted in every state except Wyoming between 2000 and 2013.

However, there's still a lot of catching up to do: In 2016, there were 30 states where at least half of households were middle class, up from 28 in 2013. But that's still down from 43 states in 2000.

"I think the main thing you are seeing is that the middle class is still struggling in most places," said David Madland, a senior fellow at the left-leaning Center for American Progress and author of Hollowed Out: Why the Economy Doesn't Work without a Strong Middle Class.

A booming economy and a tight labor market may have raised wages for those on the bottom rung of the economic ladder, Madland said, but middle-class wages have not gotten a significant boost.

Related: My road back from the Great Recession

"Tight labor markets help, but in today's economy they aren't enough," Madland said. "Workers don't have enough bargaining power to get much of a raise."

Chris Edwards, an economist at the conservative Cato Institute, said the middle class has continued to do well this year because of rising wages and tax cuts for some workers, but at the expense of higher government spending that will come back to haunt it.

"My message to the middle class is, 'Enjoy it while you can,' because Washington is building up a pile of debt that's going to eventually land on the middle class by pushing taxes up," Edwards said.

Only Alaska and Hawaii had a larger share of middle-class households in 2016 than in 2000 — and in both cases, the increase was just two-tenths of a percentage point, to about 55%. Alaska and Hawaii are the two states with the lowest concentration of wealth in the top 1%, according to a 2015 study by economist Mark Frank at Sam Houston State University in Texas.

The recent increase in the share of middle-class households is likely due to the rapid pace of economic recovery in recent years, Frank said.

"After the Great Recession, things popped back pretty fast," Frank said.

Most states did see an expanding middle class between 2013 and 2016, though in all but three — Montana, Connecticut and Georgia — the increase was smaller than 2 percentage points. In Montana, the share of middle-class households grew by nearly 3 percentage points, from 51% in 2013 to 54% in 2016. In 2000, 55% of Montana households were middle class.

Related: 10 years after the financial crisis, have we learned anything?

The share of middle-class households in Connecticut and Georgia grew by 2 percentage points between 2013 and 2016, to 51 percent in Connecticut and 49 percent in Georgia. In both states, the share of middle-class households declined by more than 4 points between 2000 and 2013.

Idaho was the only state where the erosion of the middle class accelerated between 2013 and 2016. After declining by less than 1 percentage point between 2000 and 2013, Idaho's share of middle-class households dropped by more than 2 percentage points between 2013 and 2016, to 53 percent.

Even if the size of the middle class in a particular state grows, the households in that category may be less prosperous if their incomes are stagnant or declining.

In most states, however, middle-class households benefited from rising incomes between 2013 and 2016: In 35 states where inflation-adjusted median income declined between 2000 and 2013, it rose between 2013 and 2016.

Wyoming was the only state to see an income decline, of about 2%, between 2013 and 2016.

The Pew Charitable Trusts funds both the Pew Research Center and Stateline.