Jake Gosling's drilled cross was turned in by Lee Mansell before Shaun Miller's lob levelled for the Shrimps.
Billy Bodin and Matty Taylor both converted to give Rovers a two-goal cushion but Tom Barkhuizen stroked home from close range to reduce the deficit.
In the final 10 minutes both sides were awarded penalties with Ellis Harrison netting for Rovers and Paul Mullin for Morecambe, the visitors moving to 12th.
Bristol Rovers triumphed in a seven-goal thriller away at Morecambe.