The Metropolitan Transportation Authority faces a deficit of hundreds of millions of dollars in a few years unless it finds alternative sources of revenue.

The agency’s chief financial officer Robert Foran warned MTA board members Wednesday that declining subway and bus ridership and falling revenue from real-estate transactions pose a threat as the agency takes on additional costs to improve subway performance.

Mr....