Costochondritis causes pain in the rib cartilages at the front of your chest. These can become inflamed and sore, sometimes with viral infection. Lung pain can occur anywhere in your chest, front or back. Often this pain is worse when you cough or take a deep breath. It is a sign that the lining of the lung and the inside of the chest wall are sore and are rubbing on each other. This can happen in chest infections.