This study will enroll people with advanced IPF. Participants will be randomly assigned to receive sildenafil or placebo three times a day for 12 weeks. Study visits will occur at baseline and Weeks 1, 6, and 12. At Week 12, participants will have the option to continue in the study for an additional 12 weeks. All participants who agree to continue in the study will receive sildenafil three times a day for the second 12 weeks. Study visits will occur at Weeks 13, 18, and 24. At all study visits, a physical exam and blood collection will occur. At selected visits, the following study procedures will occur: lung function testing; urine collection; a 6-minute walk test, which will measure the distance walked in a 6-minute period; and questionnaires to assess health status, breathing, and quality of life. Participants will record medication usage and symptoms in a daily diary. Study researchers will review medical records and the Social Security death index 5 years following the end of the study to determine the incidence of death among study participants.