It exits the pelvis through the greater sciatic foramen to insert on the greater trochanter of the femur.
Its tendon often joins with the tendons of the superior gemellus, inferior gemellus, and obturator internus muscles prior to insertion.
It is situated partly within the pelvis against its posterior wall, and partly at the back of the hip-joint.
It arises from the front of the sacrum by three fleshy digitations, attached to the portions of bone between the first, second, third, and fourth anterior sacral foramina, and to the grooves leading from the foramina: a few fibers also arise from the margin of the greater sciatic foramen, and from the anterior surface of the sacrotuberous ligament.
The muscle passes out of the pelvis through the greater sciatic foramen, the upper part of which it fills, and is inserted by a rounded tendon into the upper border of the greater trochanter behind, but often partly blended with, the common tendon of the obturator internus and gemelli.
It may be united with the gluteus medius, or send fibers to the gluteus minimus or receive fibers from the superior gemellus.
It may have only one or two sacral attachments or be inserted in to the capsule of the hip-joint.
This syndrome occurs when the piriformis irritates the sciatic nerve, which comes into the gluteal region beneath the muscle, causing pain in the buttocks and referred pain along the sciatic nerve. This referred pain is known as "sciatica." 15% of the population has their sciatic nerve coursing through the piriformis muscle. This subgroup of the population is predisposed to developing sciatica.
University of Washington - "Piriformis"