Ipswich stayed on course for the play-offs thanks to second-half goals by Pablo Counago and Marcus Bent.
They came in the space of just five minutes to seal victory for Joe Royle's men, which leaves them still breathing down Wolves' neck along with East Anglian rivals Norwich.
Gillingham contributed as much as Ipswich did in some respects and the Gills hit the woodwork twice through Simon Osborn and Paul Shaw before Ipswich struck their second.
Goalscorer Bent started on the bench but came on to give Ipswich the fresh legs they needed but Gillingham are conceding too many goals for their own good and poor Vince Bartram has now picked the ball out of the net 11 times in the last week.
Ipswich, having sold two players for just short of £2million in the past week, dominated early on and Gillingham might have been chasing the game by half time. A Counago header clipped the bar before skipper Paul Smith had Gillingham's best shot which went straight at Andy Marshall.
Then Nayron Nosworthy seemed to bring down Tommy Miller in the box but referee Mr Crick gave nothing. Gillingham went down the other end and experienced strikers Tommy Johnson and Rod Wallace combined well to set up an opening which saw the ball deflect off Richard Naylor with Marshall palming the ball away.
Then Martijn Reuser hit the bar before Gillingham took the lead just before the half hour Osborn's corner found Chris Hope and his header was blocked, but Smith following up netted his third of the season.
Four minutes later Ipswich equalised as Gillingham failed to clear on their right hand side and Miller's low ball into the area found its way into the far corner with Counago just failing to get a touch.
Miller should have made it 2-1 minutes later but shot wide and then another shot from Counago was saved by Bartram on the stroke of half time.
Gillingham's best spell of the game came in the first 20 minutes of the second half Shaw had a shot saved by Marshall and then Osborn fired against the post before Shaw again went close with a 25-yard strike which bounced off the top of the bar Then Counago made it 2-1 on 73 minutes and Bent put the result beyond doubt soon afterwards.