Yuvraj Singh marked his return to form with a sparkling century, but a batting disaster left the Indians on their knees at close on an eventful second day of their warm-up game against Sri Lanka Board President's XI in Colombo on Wednesday.
Replying to the home team's mammoth first innings total of 514 for nine declared, the Indians were bundled out for 291 at the fag end of the day, mystery spinner Ajantha Mendis scalping six wickets, at the Colts Cricket Club.
The tourists trail by 223 runs at stumps and the home team has the option of enforcing the follow-on when the third and final day begins on Thursday.
Mendis gave away just 67 runs in his 17.2 overs and denied the Indians a chance to redeem pride after having failed terribly while bowling.
Gambhir (89) missed out on a hundred but Yuvraj scored a measured 118 as the duo shared a 143-run stand for the fifth wicket to lift India from a precarious 80 for four.
But once the partnership was broken by Mendis, India just about managed to get near the 300-run mark.
It was pacer Chanaka Welegedara who struck the early blows, accounting for dangerous Virender Sehwag (18) and dependable Rahul Dravid (11).
Mendis then began weaving his spin magic and his first victim was Sachin Tendulkar (4), who fell leg before.
The stylish VVS Laxman arrived at the crease but his stay was cut short as Mendis, who had him caught by Prassana Jayawardene behind the wicket, leaving India tottering at 80 for four.
Gambhir, who was holding one end brilliantly, found an able ally in Yuvraj and the two left-handers rescued India with their terrific partnership.
Mendis was at it again as he separated the pair by scalping Gambhir.
Young off-break bowler Sachithra Sananayake then struck two telling blows, dismissing India skipper Mahendra Singh Dhoni and Yuvraj.
Yuvraj, who returned to team after being dropped for poor form, hit six sixes and 11 fours in his 154-ball knock.
Mendis then quickly wrapped up the innings by sending back Ishant Sharma and Pragyan Ojha.
Earlier, Sri Lanka resumed their innings at 432 for five and added 82 runs to their total before declaring.
Overnight batsmen Dinesh Chanadimal, who was on five on Day 1, remained unconquered on 47.
Pragyan Ojha claimed two more wickets to take his tally to 5 for 153.
Sri Lanka BP XI (1st innings):
U Tharanga c Laxman b Ojha 110
R Thirimanne c Gambhir b Ojha 66
T Kandamby st Dhoni b Mishra 101
T Samaraweera c Gambhir b Ojha 102
P Jayawardene st Dhoni b Mishra 13
D Chandimal not out 47
K Silva b Sharma 19
M Senanayake lbw b Mithun 11
A Mendis b Ojha 10
C Welegedara lbw b Ojha 0
Extras: (lb-7, wd-2, nb-26) 35
Total: (for 9 wickets decl; in 104.3 ov) 514
Fall of wickets: 1-188, 2-209, 3-389, 4-418, 5-418,6-468, 7-484, 8-513, 9-514.
Bowling: I Sharma 23-3-104-1, A Mithun 25-2-99-1, A Mishra 26-1-125-2, V Sehwag 2-0-15-0, P Ojha 27.3-0-153-5, Yuvraj Singh 1-0-11-0.
Indians (1st innings):
G Gambhir c Tharanga b Mendis 89
V Sehwag b Welegedara 18
R Dravid b Welegedara 11
S Tendulkar lbw b Mendis 4
VVS Laxman c Jayawardene b Mendis 6
Yuvraj Singh b Senanayake 118
MS Dhoni c Kandamby b Senanayake 10
A Mishra lbw b Mendis 1
I Sharma c Senanayake b Mendis 5
P Ojha c Kandamby b Mendis 4
A Mithun not out 9
Extras: (b-5, lb-2, wd-1, nb-8) 16
Total: (all out in 64.2 overs) 291
Fall of wickets: 1-36, 2-59, 3-67, 4-80, 5-223, 6-241, 7-252, 8-273, 9-278.
Bowling: C Welegedara 10-1-45-2, D Fernando 12-1-55-0, M Senanayake 23-1-94-2, A Mendis 17.2-3-67-6, T Kandamby 2-0-23-0.