West Indies edged into a lead of 34 runs with three first innings wickets in hand on an attritional third day of the first Test against England at Sabina Park on Friday.
But England, thanks to three wickets from seamer Stuart Broad, made the home side work for every run.
In fact, just 192 runs were scored all day, as West Indies finished the day on 352 for seven in reply to England's first innings total of 318.
Gayle went before lunch for 104 and was quickly followed by Xavier Marshall (0), and after the interval Sarwan (107) and Shivnarine Chanderpaul (20).
The hosts had hoped to create an imposing total from the foundations built by centurions Chris Gayle and Ramnaresh Sarwan, who shared a 202-run partnership for the second wicket.
England must have sensed a West Indian middle-order collapse, with four wickets having gone for just 34 runs, but they were frustrated as Australian-born Brendan Nash and wicketkeeper Denesh Ramdin put together a solid partnership.
The pair batted sensibly and patiently to put on 66 in 26 overs and by the time Ramdin went, caught by Paul Collingwood at slip off spinner Monty Panesar, West Indies were two runs ahead.
It was just the sort of application West Indies coach John Dyson has been urging from his supporting batsmen and exactly the reason why he turned to the 31-year-old Nash, who qualified for selection through Jamaican parentage.
Resuming on 160 for one, Gayle and Sarwan carried on as they had left off on Thursday, batting with care against a fiery Andrew Flintoff but keeping the run-rate ticking along nicely against the other bowlers.
Captain Gayle brought up his ninth Test century, and his first on his home ground of Sabina Park, in majestic style.
He cracked spinner Monty Panesar for two successive sixes over mid-on before reaching three figures with a sweep to fine leg for three.
Having reached his ton, Gayle inside-edged a Broad delivery that kept low on to his stumps.
Broad, bowling a consistently good line, then struck again quickly with a good length delivery that cut back to trap Marshall leg before.
Sarwan, who reached 5,000 Test runs when he passed the 91 mark, completed his century with a careful paddle for four down to long-leg.
But the always-threatening Flintoff grabbed his prize when Sarwan played on with an inside edge.
A partnership of slow consolidation between Nash and Chanderpaul was cut short when the Guyana left-hander was trapped lbw by Broad.
Nash, who has made an impressive start to his test career, then got his head down with Ramdin and later Jerome Taylor, to close on what could be his third half-century in four innings.
Near the close, Taylor departed for eight, lbw not offering a shot to Steve Harmison and Nash was unbeaten on 47 along with Sulieman Benn.
England (1st innings):
A. Strauss c Ramdin b Taylor 7
A. Cook c Sarwan b Powell 4
I. Bell c Smith b Gayle 28
K. Pietersen c Ramdin b Benn 97
P. Collingwood lbw b Benn 16
A. Flintoff c Nash b Powell 43
M. Prior c & b Benn 64
S. Broad c Benn b Taylor 4
R. Sidebottom not out 26
S. Harmison lbw b Taylor 7
M.Panesar lbw b Benn 0
Extras: (b 7, lb 8, nb 7) 22
Total: (all out; 122.2 overs) 318
Fall of wickets: 1-8, 2-31, 3-71, 4-94, 5-180, 6-241, 7-256, 8-288, 9-313.
Bowling: Taylor 20-4-74-3 (3-nb); Edwards 14-1-58-0 (3-nb); Powell 20-5-54-2 (1-nb), S. Benn 44.2-13-77-4; C. Gayle 24-9-40-1.
West Indies (1st innings): (overnight 160-1)
C. Gayle b Broad 104
D. Smith lbw b Flintoff 6
R. Sarwan b Flintoff 107
X. Marshall lbw b Broad 0
S. Chanderpaul lbw b Broad 20
B. Nash not out 47
D. Ramdin c Collingwood b Panesar 35
J. Taylor lbw b Harmison 8
S. Benn not out 10
Extras: (b-6, lb-8, w-1) 15
Total: (for seven wickets; 144 overs) 352
Fall of wickets: 1-18 2-220 3-220 4-235 5-254 6-320 7-341
Bowling: Sidebottom 24-5-35-0, Flintoff 27-9-57-2, Harmison 20-4-49-1 (1w), Broad 24-7-61-3, Panesar 45-13-121-1, Pietersen 4-1-15-0.
To Bat: D. Powell, F. Edwards.