The piriformis is a flat, pyramid-shaped muscle that lies parallel to (in line with) the gluteus medius muscle’s back margin and underneath the gluteus maximus muscle in the hip area.

The muscle passes through the greater sciatic foramen (a space in the pelvic bones, on each side of the center) and to the upper part of the greater trochanter (a bone ridge near the top of the femur, or thigh bone). It takes up the most area in the greater sciatic foramen.

It’s a small muscle compared to other muscles of the region.

The piriformis helps rotate the hip and works with rotators such as the obturator externus and the gemellus inferior. It rotates the thigh externally while extended (for example, while walking) and abducts the hip when the thigh is flexed at 90 degrees (for example, when placing the ankle on the opposite knee while sitting).

The nearness of the piriformis muscle to the sciatic nerve, which is the largest nerve in the human body, can result in pain in some individuals. This pain can run from the buttocks to the lower back.

Treatment for a strain of this muscle includes physical therapy, deep tissue massage, and anti-inflammatory medication, which reduces swelling around the sciatic nerve.