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 is a small muscle when 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 will rotate the thigh while extended and will abduct, or pull inward, the thigh when flexed.
The close nature of the piriformis muscle to the sciatic nerve, which is the largest nerve in the human body, can cause 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.