Stevenage confirmed a play-off place after a thrilling draw with Bury.
The home side were in front when Scott Laird crashed home low into the corner, but Steven Schumacher equalised soon after for the Shakers from 20 yards.
Stevenage regained the lead when Chris Reid scored from the penalty spot, but Nicky Ajose nodded home to level before half-time from Mike Jones' cross.
Another long-range strike from Schumacher made it 3-2 to Bury but Ben May equalised with 15 minutes left.
The result means Gillingham now miss out on a League Two play-off place, while Stevenage are set to face Accrington in a two-legged semi-final.
Promoted Bury had a chance of winning the title going into the game, but Chesterfield's 3-1 win over the Gills meant a win would not have been enough for the Shakers.
Stevenage manager Graham Westley told BBC Three Counties Radio:
"The game itself was a terrific affair. Both sides obviously trying to win the game, football end to end, both attacks probably getting the better of both defences which was a surprise because we had the two best defences in the league coming into the game.
"Whatever was going on elsewhere, we knew it was in our hands. I was pretty aware in the last ten minutes that 3-3 would pretty much see us through. I consolidated and made sure we brought the point in that would consolidate us into sixth.
"I think the lads deserve all the credit that they are going to get. I think at the same time, they'll take the credit but keep their feet on the floor. They know there is a lot of work still to be done."
Bury caretaker manager Richie Barker told BBC Radio Manchester:
"I'm probably glad Chesterfield won as if we'd have drawn and they got beat, I would have been more annoyed.
"I think we're the best footballing side in this division and I said to the players to go out and advertise themselves.
"Everybody has pulled together and worked really hard and everyone's attitude for the past few weeks have been brilliant."