text: ive been having spasms near my right rib cage? ummm and it feels weird, mostly when im lying down and i have no idea what it is....anyone else know? sounds like your diaphragm...the muscle between your chest and your abdomen that allows your lungs to breath in and out is having spasms...it happens, and alot of people mistake them for heart palpitations.  if they get painful, call your doctor.