England's first innings score of 537 was built around Ali's 117 and an impressive 128 runs by Ben Stokes.
England's first innings score of 537 was built around Ali's 117 and an impressive 128 runs by Ben Stokes, who managed to banish memories of three ducks against India in his three previous innings.
India's openers Gautam Gambhir (28 not out) and Murali Vijay (25 not out) responded with an unbeaten stand of 63 in the final session on the second day, the hosts trailing by 474 runs with all their wickets intact.
The stylish Joe Root (124) had notched up a century on the opening day to lay a solid foundation for England's middle-order batsmen at Rajkot's Saurashtra Cricket Association ground.
The day belonged to England's batsmen who made India pay for their sloppiness in the field that saw them drop at least five catches.
"Patience is something Saqi (spin coach Saqlain Mushtaq) talks about a lot, we knew we needed to be patient," said Ali, 29, after the day's play.
"It's a very good pitch. We didn't plod much against the spinners and tried to be attacking in our approach," said Ali.
The spinning all-rounder also insisted he slept well despite going to bed at 99 not out Wednesday.
"I slept really well. I was pretty normal, I was fine."
India's bowlers struggled in the heat and grime, with top-ranked spinner Ravichandran Ashwin conceding 167 runs while taking just two wickets.
But left-arm spinner Ravindra Jadeja was quick to spring to Ashwin's defence, saying any bowler can have an off-day.
"It's part of the game. We were playing five bowlers. It is the responsibility of every bowler and not just Ashwin to take wickets," said Jadeja.
"Sometimes half-chances get converted and on some days easy chances are dropped."
Although England lost a succession of tailenders in the period immediately after lunch, Stokes stayed put to help England post their third highest total on Indian soil.
Stokes hit 13 fours and two sixes en route to his fourth ton in the longest format of the game.
England were on the attack in the morning session, hammering 139 runs while losing two wickets including that of Ali who was bowled by Mohammed Shami (2-65).
Jonny Bairstow, the highest Test run-scorer this year, made 46 and shared a brisk 99-run partnership for the sixth wicket with Stokes before also falling to Shami.
Stokes was dropped twice in his sixties by wicketkeeper Wriddhiman Saha with Umesh Yadav (2-112) being the unlucky bowler on both occasions.
The Indians took the new ball in the morning after England who had won the toss resumed at 311 for 4, but failed to get an immediate breakthrough.
Ali reached his century off the third ball of the day from Shami who seemed to have recovered from the cramps he suffered on the opening day.
The spinning all-rounder singled out Yadav for special punishment, taking three fours in four balls off the paceman.
Stokes chipped in before Shami broke their 62-run stand with the wicket of Ali, who saw his off-stump cartwheel away after misjudging the line and not playing a shot.
England's total was the highest by a visiting team in India since the West Indies made 590 at Mumbai in November 2011.
And the last time three visiting batsmen scored centuries in the same innings in India was in 2008-09 when Sri Lanka toured the country.
Top-ranked India have won 12 and drawn one of their last 13 Tests at home since England sealed a historic 2-1 victory in Kolkata in 2012.