When bad light ended play early, India were sitting pretty on 180 for two in 35 overs in their first innings in reply to Sri Lanka's [ Images ] 425.
Sehwag, who was dropped on 52 by Angelo Mathews [ Images ], was unbeaten on a cracking 97 from 87 balls, inclusive of 17 fours.
Sachin Tendulkar [ Images ] also continued his good run of form, hitting 40 from 66 balls, as the two batsmen put on an unbroken stand of 88 for the third wicket.
Sehwag, who brought up his fifty from just 44 balls, also became the second fastest to complete 7000 runs in Test cricket, while also crossing the landmark of 1000 boundaries in the longer version of the game.
Angelo Mathews then struck in his first over, claiming the wicket of Rahul Dravid [ Images ], leg before wicket for 23.
Earlier, Thilan Samaraweera's [ Images ] unbeaten century helped Sri Lanka post a competitive 425 in 138 overs in their first innings.
Samaraweera was left stranded on a splendid 137, inclusive of 12 boundaries and a six, off 288 balls during his 370-minute stay at the crease.
Pacer Ishant Sharma [ Images ] claimed two wickets in an over to end the innings and finish with three for 72 in 23 overs.
Pragyan Ojha [ Images ] emerged India's best bowler, claiming impressive figures of four for 115 in 46 overs, but there was no joy for his spinning partner Amit Mishra [ Images ], who took one for 140 in 42 overs, on a pitch offering a lot of help for the slower bowlers.
Mathews (45) was the first wicket to fall on day two when he was also trapped leg before wicket, after adding 89 runs for the fifth wicket with Samaraweera. Prasanna Jayawardene [ Images ] tried to sweep Ojha but missed and was declared leg before wicket for nine from 41 balls.
Suraj Randiv [ Images ] tried to slog Virender Sehwag on the leg side but got a top edge and was caught by Rahul Dravid for eight. In the next over, Lasith Malinga was caught and bowled by Amit Mishra for four.
Sri Lanka lead the series 1-0 after winning the first Test by 10 wickets, while the second ended in a high-scoring, dull draw.
Thilan Samaraweera played an uppish cut against Abhimanyu Mithun [ Images ] that just flew over Sehwag at gully for a boundary to take Sri Lanka past the 300-run mark in the 89th over.
Mathews also looked to adopt a positive approach as he hit a couple of early boundaries against the seamers.
Ishant started off well, beating the batsmen time and again, but from the other end Mithun failed to control the movement and quite often drifted on the batsman's pads.
It was not long before Mithun was replaced,as Ojha came into the attack in the sixth over of the day. The left-arm spinner got some turn immediately; he struck Mathews on the pads and had a huge shout for leg before wicket turned down.
Samaraweera looked in complete control, determined to play a big innings. He pulled a short delivery from Mithun for a boundary through fine leg to take the total to 330 for four after 100 overs.
It was Ojha who again got the vital breakthrough for India. He trapped Mathews leg before wicket with the arm ball, dismissing him after a good innings of 45, laced with six boundaries in 84 balls.
The all-rounder added 89 runs in 27.3 overs for the fifth wicket with Samaraweera to put Sri Lanka on course for a total in excess of 400.
Mishra's nightmare continued as he bowled a no-ball in his first over of the day and was pulled over midwicket for a boundary by Samaraweera.
With the ball turning and Ojha getting it right most of the time, Prasanna Jayawardene caused his own downfall by attempting the fatal sweep shot. He missed and was rightly adjudged leg before wicket for nine, as Sri Lanka slipped to 358 for five.
But Samaraweera continued his toil and soon brought up his 12th Test century off 229 balls, 11 of them coming on the flat wickets in the sub-continent.
At lunch on the second day, Samaraweera was unbeaten on 104 from 229 balls, laced with ten boundaries, while Suraj Randiv was not out on two, as Sri Lanka reached 369 for six in 117 overs.
Ojha was again brilliant with the ball for India as he took four for 97 in 39 overs. He showed loads of patience and persisted bowling on a good line and length and was aptly rewarded with wickets.
Mishra was exactly the opposite from the other end; he hardly found his rhythm despite bowling 33 overs in the match so far.
Ishant (one for 62) started well in the morning session, but was unlucky not to pick any wicket, as he moved the ball a great deal and beat the batsmen often.
India strung up a few tight overs after the lunch break before part-timer Sehwag claimed the wicket of Randiv, who top-edged a slog and was caught on the off-side, for eight.
Lasith Malinga, who scored a quick fifty in the first Test, got off the mark in some style when he slog-swept Mishra for a boundary through midwicket.
But Mishra had the last laugh, having him caught and bowled for four to reduce the hosts to 386 for eight.
The spinners, Ojha and Mishra, settled down quite nicely after lunch and restricted Samaraweera to singles while attacking him. The right-hander finally lost patience and broke the shackles with a slog-sweep against Mishra for his 11th boundary and took Sri Lanka past 400 in that same over, the 132nd of the innings.
Ajantha Mendis was content to just defend and took 30 balls to get off the mark. At the other end, Samaraweera decided to force the issue and slammed Ojha over the cover region for his first six of the innings and hit a boundary through the same region off the next delivery.
But Ishant made sure that Samaraweera did not get more opportunities to swell the Lankan total by claiming the last two wickets in his next over.
Ishant used the bouncer quite well and had Mendis (3) fending it straight to Suresh Raina [ Images ] at gully.
Chanaka Welegedara also got a nasty bouncer directed at his body, which took his gloves en route to wicketkeeper Dhoni [ Images ]. The innings ended on 425 after 138 overs.
Samaraweera was left stranded on a fine knock of 137 that stretched for 370 minutes and was laced with 12 fours and a six off 288 balls.
Ojha took the bowling honours for India as he claimed four for 115 in 46 overs, while Ishant used the conditions quite well to take three for 72 in 23 overs.
Mishra (1 for 140) took time to find his rhythm, while Mithun once again impressed despite not picking wickets in 22 overs.
Lasith Malinga announced himself with three dead straight yorkers followed by a good rising delivery in the very first over of the innings.
Sehwag took eight deliveries to get off the mark, which he did in his customary fashion. He lashed at a wide delivery from Welegedara through point for a four, followed by two more through the leg side for a hat-trick of boundaries in the fourth over.
Nearly 60 per cent of Malinga's deliveries in the first three overs were bouncers, while 33 per cent were yorkers, clearly showing the variety and control he possesses.
Sehwag flicked a full delivery from Malinga through square leg for his fourth four but was soon fending off a well-directed bouncer on his body.
Welegedara tried the same trick against Sehwag, but the Indian opener pulled it through midwicket for another four to race to 21.
At tea on the second day, India were 28 for no loss in seven overs, with Sehwag on 21 from as many balls and Vijay on six from 22.
It was a good testing session for the Indian openers as Malinga tried to unsettle them with the bouncers while using the yorkers in between.
Vijay started the session with a cracking boundary through covers off the first delivery after the break as Welegedara pitched it full and wide.
Welegedara again tried the short delivery tactics against Sehwag but saw the delivery being pulled through midwicket for yet another boundary. Vijay got another boundary in the over when he hit one past the mid-off fielder to take the total to 44 after ten overs.
Even though Malinga was trying everything it was proving hard to contain Sehwag. The right-hander punched a full delivery back past the bowler for his seventh boundary of the innings.
But Sri Lanka got some relief when Malinga claimed the wicket of Vijay. The right-hander hit a full delivery straight to the cover fielder and was dismissed for 14 after a 49-run opening stand.
Rahul Dravid was peppered with a few short deliveries by Malinga which he managed to defend. And when the pacer pitched it up a bit, the ace batsman got off the mark with two stylish boundaries through mid-off and midwicket respectively.
Welegedara tried to keep Sehwag quiet by bowling short and wide outside the off-stump with a packed off-side field. Sehwag watched a few go by before shuffling across and pulling one over square leg for his ninth boundary, while a few balls later he slammed one down the ground for the same result.
India raced to 71 for one after 14 overs before Sri Lanka brought on spinner Ajantha Mendis to replace Malinga.
Welegedara continued to suffer, as he was hit for three more boundaries in his next over. First, Sehwag slashed at a wide delivery but got an edge that flew to the thirdman boundary to bring up his half-century from just 44 balls, having hit 11 boundaries in total.
Dravid took a cue from Sehwag's book as he hit Welegedara for back-to-back boundaries to end that over. In the next over from Mendis, Dravid tried to cut a short delivery but got a thick edge which again went for a four as the right-hander raced to 20 from only boundary hits.
Welegedara conceded 59 runs in eight overs, suffering mainly at the hands of Sehwag, who hit him for nine boundaries for 39 runs in 28 balls.
The Dravid-Sehwag partnership produced 43 runs in no time before Mathews struck. In his first over, Mathews trapped Dravid leg before wicket for 23 with an incoming delivery. However, Dravid must consider himself unlucky as the incoming delivery struck him on and around leg stump but the umpire ruled in favour of the bowler.
Sachin Tendulkar showed his intent as he slog-swept Mendis over midwicket for a boundary to get off the mark.
Meanwhile, much to India's relief, Sehwag (52) got a lifeline when Mathews dropped a sharp caught and bowled chance, in the 20th, over as India crossed the 100-run mark in that over.
Sehwag cut Mathews for a boundary through point to bring up his 1000th boundary in Test cricket to go along with his 79 sixes, in his 79th match. The dasher also brought up his 7000 runs in Tests in his 134th innings -- the second fastest after Englishman Wally Hammond, who brought up the landmark in 131 innings.
With Sehwag looking to slow down and play for stumps, Tendulkar got the boundaries; he hit a four each of Mendis and Malinga. The veteran batsman had a close shave when he tried to cut Randiv, but the resultant edge flew past the first slip fielder for a boundary.
After a few quiet overs, Sehwag suddenly lifted the tempo by hitting a couple of boundaries through the leg side to help India maintain a run rate of around five runs per over as they reached 161 for two after 31.
The dashing opener then cut Randiv through the point region for his 16th boundary to enter into the 90s for the third consecutive time in the series. He repeated the dose on Welegedara for yet another four through thirdman to inch closer to the three-figure mark.
Tendulkar tried to shut shop as the light faded, looking to preserve wickets, while Sehwag was desperately looking to take the strike and complete his century.
The umpires made sure Sehwag would spent a night in the nervous nineties as play was called off early because of bad light.
At stumps, India had posted 180 for two in 35 overs, scoring at more than five runs per over. In fact they they scored 152 runs in 28 overs in the final session, with Sehwag leading the charge to end the day on a high.
Sehwag finished unbeaten on a cracking 97, having hit 17 fours in his 87-ball knock, while Tendulkar also looked good on 40 from 66 balls.
Malinga tested the batsmen quite a bit, but even he went for runs, claiming one for 52 in 11 overs. Welegedara suffered a lot, giving away 65 runs in nine overs and Mendis gave away 32 runs in seven overs, while Mathews took one for 13.
With India trailing Sri Lanka by 245 runs, their batsmen need to dominate another couple of sessions and they could well put the team in control.