The Gills were hoping to take their place in the Priestfield history books with an 11th away league win of the season and would have also returned to the top of the table with a victory.
But the Minstermen, who were excellent in the first half, deserved a share of the spoils even though Charlie Lee struck the crossbar with a late, long-range volley for the visitors.
Gillingham squandered the first good chance of the night after Cody McDonald fired into the sidenetting from a narrow angle when ex-Sheffield Wednesday striker Deon Burton was unmarked in the penalty box.
But York dominated for long periods of the first half with on-loan Aldershot striker Michael Rankine, making his second debut for the club, causing problems.
The 6ft 3in target man had two headers cleared off the line from Ashley Chambers corners before the break. He also set up good opportunities for Curtis Obeng and Matty Blair that were not taken.
The visitors improved after the break with Andy Frampton testing goalkeeper Michael Ingham from 30 yards and McDonald then heading over when it was easier to score from a Joe Martin cross.
Matt Fish also fired wide from distance on 67 minutes. York rallied with Blair forcing Stuart Nelson into a near-post save but it was substitute Lee who went closest to winning the game when his 35-yard strike hit the woodwork.
York: Ingham, Obeng, Parslow, O’Connell, Fyfield, Challinor (Rodman 76), Kerr, McGrath, Blair, Rankine, Chambers (McLaughlin 81). Unused substitutes: Musselwhite, Walker, Potts, Everson, Allen.
Gillingham: Nelson, Fish, Barrett, Legge, Martin, Allen (Weston 46), Frampton, Robinson (Lee 85), Whelpdale, McDonald, Burton (Birchall 64). Unused substitutes: Forecast, Davies, Dack, Gregory.
Referee: S Martin (Staffordshire).