Pain in middle back on right side under rib cage. Started aboit 2 1/2 months ago. Today sharp pain a few times on the left side in back under rib cage. Aches more in in the mid back going down to lower back as the day goes on.

Below. You will need a medical exam to determine the etiology of pain. There are many possibilities, and without exam, guessing would not be wise.
Back pain! . You and approximately 40 million other Americans have low back pain. Try NSAIDs and PT and bed rest and that frequently works. If that doesn't work consider adding muscle relaxants. If that doesn't work try a physiatrist. If someone suggests surgery, BEWARE!