Strong foreign capital inflows into equity market along with upbeat US data and easing oil prices boosted the market sentiment.
Shares of Auto, Power, Healthcare, Capital Goods, Metal, PSU and Banking firmed up on good buying enquiries.
Small-cap and Mid-cap shares also moved up on good demand from retail investors.
The Sensex opened higher at 25,179.55 and moved up further to an all-time high of 25,999.08 before ending at 25,962.06, showing a sharp gain of 862.14 points or 3.43 per cent. It had lost 296.54 or 1.17 per cent in the previous three weeks.
The NSE 50-share Nifty also rose to an all-time high of 7,758.00 before finishing the week at 7,751.60, showing a gain of 242.80 points or 3.23 per cent. It had also by 74.60 points or 0.98 per cent in the previous three weeks.
Foreign Portfolio Investors (FPIs) bought shares worth a net Rs 4,367.51 cr during the week as per the SEBI data, including the provisional figure of July 4.
US stocks rose with the Dow Jones Industrial Average hitting 17,000 for the first time and the S&P 500 index also scaling records after June jobs report. Now, the countdown has begun for the Union Budget and market participants are eyeing pre-budget rally, said Jayant Manglik, President-retail distribution, Religare Securities.
Uptick in manufacturing sector growth and signs of pickup in auto sales outweighed concerns of a poor monsoon. India's manufacturing sector growth in June expanded at the fastest pace since February, supported by growing order flows, especially from overseas, an HSBC survey said.
On the global front, growth in China's manufacturing in June indicating arrest in slowdown in the world's second-biggest economy also the another factor behind rise in share prices.
Meanwhile, Finance Minister Arun Jaitley's comments fuelled buying on hopes the Union Budget next week would list steps to curb surging deficit and rev up growth.
"The participants responded positively to the statement made by the Finance Minister that the government would take bold decisions in the forthcoming Budget (July 10) to revive the economy," said Jayant Manglik, President-retail distribution, Religare Securities.
Trading on the BSE was disrupted for three hours due to network outage on July 3rd.
Among the 30-share Sensex pack, 28 stocks gained and only two of them declined in the week.
Major gainers from the Sensex pack were Tata Motors (8.37 per cent), Maruti Suzuki (7.88 per cent), Hidnalco Ind (7.51 per cent), BHEL (7.33 per cent), Sun Pharma (7.25 per cent), M&M (6.52 per cent), ICICI Bank (5.61 per cent), SSLT (5.50 per cent), Dr Reddy's Lab (5.04 per cent), HDFC Bank (5.02 per cent), Larsen (4.56 per cent), ITC (4.21 per cent), HDFC (3.40 per cent), Tata Power (3.28 per cent), Coal India (3.11 per cent), RIL (2.47 per cent), Cipla (2.42 per cent), ONGC (2.64 per cent) and SBI (2.36 per cent).
Among the S&P BSE sectoral indices, Auto rose by 5.91 per cent followed by Power 5.18 per cent, HC 5.18 per cent, CG 4.89 per cent, Metal 3.88 per cent, PSU 3.77 per cent and Bankex 3.74 per cent.
Small-cap and Mid-cap indices also rose by 4.85 per cent and 3.70 per cent, respectively.
Total market turnover on the BSE and the NSE rose to Rs 16,906.51 crore and Rs 89,279.00 crore respectively from the last weekend's level of Rs 16,443.20 crore and Rs 84,601.92 crore.