North Dakota's oil and natural gas production both hit records in July, buoyed by strong global oil demand.

Still, North Dakota's success is causing a problem: For one, with more production, more natural gas is being flared — i.e., burned off — and the state is running up against its own flaring limits.

North Dakota, the nation's second-largest oil-producing state after Texas, pumped out 1.27 million barrels of oil per day in July, up 3.4 percent over the previous month, according to state data released Friday.

Production rose in July after oil prices hit 3 ½-year highs. West Texas Intermediate — the benchmark U.S. crude price — peaked at around $74 per barrel in early July before settling back since. Prices fell to $65 per barrel in August, but have since rallied to $69.

"Supply and demand [of oil] are essentially in balance at this point," Lynn Helms, director of North Dakota's Department of Mineral Resources, said during a conference call with reporters.

North Dakota's oil-rig count currently stands at 65, four more rigs than in August but one fewer than in July. Helms said that producers would like to deploy about 70 rigs, which drill new wells, but are constrained by structural issues in the state's oil market.

First, the industry is "really struggling" to find enough workers for fracking crews, Helms said. North Dakota is competing with other oil states for rig hands in a strong economy with tight labor markets.

Second, there's "the ongoing struggle with gas capture," he said. Oil wells also spit out plenty of natural gas in North Dakota. But the state's gas processing plants and pipelines can't keep up with the production. So, natural gas is flared, wasting resources and emitting carbon dioxide into the atmosphere.

North Dakota has set goals on how much gas must be captured, and thus limits on how much can be flared. Gas-capture goals are slated to rise in November, yet the industry is likely to fall short of them, Helms said. When asked if some companies' oil and gas production may be restricted, he said "I suspect there will be."

The state's natural gas production in July rose by 4.3 percent to 2.4 million MCFs per day (an MCF is 1,000 cubic feet of gas).