Flexeril is most often prescribed by doctors to help their patients alleviate muscle spasms or muscle pain that is caused by any type of muscle injury, including a muscle sprain or strain. However, the drug has also been used to treat pain caused by fibromyalgia and on in rare cases to help patients sleep better.