I've had this problem off and on. What helped me was stretching my hamstring muscles. This help them from pulling on my back muscles which would twist my back and cause the pain.
I stretched my hammys by laying flat on the floor near an open doorway. place one leg on the wall near the open door and the other lay flat on the floor through the open doorway. Slowy straighten your leg and scooch your butt up against the wall. Remember, slowly is the key. It hurts but soon you will feel the relief. The key to the good stretch is to get your leg straight and 90 degrees to your torso, butt against the wall. Then repeat on the other side of the door with your other leg.
I'm not a Doctor though so maybe you want to ask one first. Here's a quick diagram showing the stretch. Don't mind my quicky graphic.
Remember, keep your floor leg flat on the floor, don't bend the knee. Hope you find relief soon as I know just how bad it is.