A 61-year-old man is admitted to the hospital for a hypercapnic COPD exacerbation requiring intubation and mechanical ventilation. He receives intravenous glucocorticoids, antibiotics, and supportive care. He is a former smoker and is moderately deconditioned.

After 5 days of mechanical ventilation, his condition has improved, but a spontaneous ventilation trial fails, with increased respiration rate and work of breathing after 20 minutes.

On physical examination, he is afebrile, blood pressure is 132/85 mm Hg, and pulse rate is 75/min. Breath sounds are decreased throughout both lung fields. At the end of his spontaneous breathing trial he appears fatigued but is awake and alert. The remainder of the examination is unremarkable.

Which of the following is the most appropriate management?