This could be a prolonged cough, intercostal neuritis, intercostal neuralgia, or it could be chondritis of the ribs caused by trauma, or even a fracture, which can also cause the pain of deep breathing. There is also inflammation of the lungs or even a tumour invading the pleura, causing pleurisy resulting in painful deep breathing.
If the pain is caused by strain or sports injury, thoracic myofasciitis can be treated with physiotherapy and oral anti-inflammatory and analgesic drugs, while if the pain is caused by infection and tumour, the appropriate treatment should be done for the cause.