How can we prevent aids patients from dying from pneumonia?

Treat HIV. Appropriate management of the HIV disease to restore immune function is the key, and then treatment of the causative agent of the pneumonia is next. This is often pnemocysitis, but can potentially be due to a host of different organisms, and specific diagnosis will determine best choices of medications.