BENGALURU, July 22 (Reuters) - Indian shares touched a seven-week high on Friday and were set for their best week since mid-March, as banks and auto stocks rallied and foreign fund investments into equities strengthened.

The NSE Nifty 50 index rose 0.2% to 16,630, as of 0510 GMT, while the S&P BSE Sensex was up 0.17% at 55,740.34. Both the indexes hit their highest since June 3 and are now eyeing a near 4% weekly gain.

The Nifty Bank index rose 0.8%, while the auto index was up 0.5%.

Banks and automobiles have been major drivers of the recent rally on the Nifty 50 index and have helped it gain more than 5% so far this month. The bank index, meanwhile, has climbed 9%, while the auto index is up around 8% in July.

"Global markets have bounced back ... There is continuous moderation of prices in commodities, which has helped boost the risk sentiment," said Gaurav Dua, head of capital market strategy at Sharekhan

"Earnings so far have been pretty decent," said Dua, adding that impact due to input cost pressures on companies' earnings has been lower than expected.

Shares of Gujarat State Fertilizers & Chemicals jumped 13.3% on strong June-quarter earnings, while Quick Heal Technologies rose 8.8% after approving a share buyback plan.

Analysts also flagged that buying by foreign investors have helped indexes sustain gains.

Foreign investors purchased a net $832.2 billion worth of Indian equities this week till Thursday, marking their first net buying for the same period in 15 weeks, according to Refinitiv data.

Looking ahead, investors will focus on a bunch of Nifty 50 companies, including Reliance Industries, UltraTech Cement and JSW Steel, which will report their earnings later in the day. (Reporting by Nallur Sethuraman and Gaurav Dogra in Bengaluru; Editing by Subhranshu Sahu and Uttaresh.V)