There are several different causes of rib pain. For example, sometimes the joints between the sternum and the ribs become inflamed. This is called costochondritis, and it tends to cause pain that will hurt more if you press over the area where the ribs and sternum come together. Costochondritis is often commonly associated with a recent viral illness
, such as the common cold. Similarly, it is possible to strain the muscles between the ribs, usually from heavy lifting or from poor postured. Strained muscles will give a pain similar to costochondritiis, although usually more diffuse.
The pain from both costochondritis and strained muscles of the ribcage tends to be worse at night. This is because the rib cage is 'squashed' by lying in bed, which puts pressure on the sensitive areas. Other activities that tend to cause worse pain include deep breaths.
I recommend that you go see your primary care doctor
about this issue. They will be able to examine the affected areas and confirm what is going on. Based on what they find, they will be able to recommend an appropriate treatment which usually, in most cases, starts with taking a good dose of an anti inflammatory medication.