WASHINGTON—A rapidly shrinking federal budget deficit is upending bipartisan talks to reach a federal budget deal, illustrating the conundrum Washington faces with an improving near-term fiscal outlook but continued longer-term pressures tied to aging baby boomers.

The Congressional Budget Office said Tuesday the federal deficit is expected to shrink to $642 billion in the fiscal year ending Sept. 30, narrowing from the agency's estimate of $845 billion three months ago and sharply lower than last year's $1.087 trillion shortfall.

...