+ 1 on the gas problem.
Start by checking everything to do with the gas system. Is your gas port open, not somehow damaged, and lined up with your FSB? Is your gas tube properly seated in your FSB and is the roll pin intact? Is the gas tube not somehow bent, warped from overheating, punctured, etc? Is the gas tube lining up properly with your carrier key and is there any damage to the tip of the gas tube? Are your gas rings lined up by accident or somehow damaged?
If you're lucky, you'll see a bit of carbon deposit where you have a leak in the gas system. Occasionally you can also feel where the system is leaking.
As for solutions, first I'd start by giving your rifle a good cleaning. Next, clean out using pipe cleaners or replace the gas tube. They'll usually ship with their own roll pin, so you can replace the one your current gas tube's using, in case it's been damaged. If you can, try a different bolt and carrier key. A long shot, but also make sure your charging handle or forward assist isn't damaged in some way that's causing the bolt to lock forward.
One last question, when it gets stuck, is the gun still in battery or does it unlock and get stuck about half way?