Benchmark indices on Wednesday extended gains for the fourth consecutive session to close at a five-month high, amid optimism of the economic downturn cycle coming to an end on account of better-than-expected corporate earnings. Reports of the government scrapping taxes on dividend payouts also helped investor sentiment.

The Sensex advanced 220 points or 0.55% to close at 40,051, while the Nifty50 Index rose 0.49% to close at 11,844.

The benchmark, which is 216 points away from its record-closing high, closed above the key 40,000-level after June 4.

Out of the 30 stocks listed on Sensex, 18 stocks closed in the green, with the highest gains recorded by State Bank of India , Infosys and Bharti Airtel. Tata Consultancy Services and Infosys together accounted for nearly half of the Sensex rally.

Analysts believe the markets are set to gain further as worries of a deep slowdown scenario have begun to recede. “The deep slowdown scenario does not appear likely as corporate results have not shocked on the downside and majority earnings have been either in-line or better-than-expectations,” said Vinod Karki, head-strategy, ICICI Securities. “Recoveries are underway when it comes to corporate earnings.”

Foreign portfolio investors (FPIs) bought shares worth $1 billion on Wednesday, the highest one-day inflow in October, provisional data on exchanges showed. This was largely due to UK-based Standard Life selling shares of HDFC Life in a bulk deal.

So far in October, overseas investors have purchased equities worth $711 million after pumping in nearly $1 billion in September. In contrast, they had pulled out nearly $4 billion in July and August. “Liquidity perspectives have eased amid expectations of a rate cut by the Federal Reserve and an expected cut by the MPC in December,” Karki added.

The revival of demand can be witnessed most in the auto sector. Among the 30-stock Sensex, industry heavyweights like Tata Motors, Maruti Suzuki India and Eicher Motors have been the best performers over the past three months, returning up to 37%. “Improved auto sales growth during the festival sessions, good quarterly results have added fuel in the market,” said Ajay Menon, managing director & CEO – broking & distribution, Motilal Oswal Financial.

Infosys shares surged by 1.51% to close at `660.45 after ICICI Securities said in its report that it found ‘no perceivable inconsistency’ in data points shared by the company with respect to the whistleblower complaints against the top management. “Looking at the allegations in isolation, some of the data points shared by Infosys, like Verizon deal being margin dilutive by 40 bps or visa costs being a margin drag of 80 bps in Q1FY20 or Stater deal being dilutive by 40 bps is consistent with the nature of these deals and investments in our opinion,” the analysts at ICICI Securities said in the report.