Treatment of hemoptysis will depend on the underlying cause. If you’re coughing up blood as a result of an infection, your provider may recommend certain medications to treat the infection. In other cases, lifestyle changes can help to treat the condition. But in more severe cases, surgery and other treatments may be considered.