Joe Ironside scored the winner from the spot in the 70th minute after Harvey Knibbs went down softly in the area after tangling with Greg Leigh, with referee Carl Boyeson awarding a penalty despite the Shrimps' protestations.
The goal came just three minutes after Morecambe had fought their way back into the game with yet another stunning strike from Cole Stockton, who volleyed home his 25th goal of the season from 25 yards to level the scores.
The game's first goal once again came in the final stages of the first half, an all-too-familiar story for the Shrimps this season.
Morecambe failed to convincingly clear their lines and Cambridge took full advantage. A move down the left ended with Knibbs being left unmarked in the box. His shot was blocked by Liam Gibson but the ball fell perfectly for Sam Smith to stroke home his 18th goal of the season from close range.
The Shrimps had their chances in an open first half and had two shots cleared off the line by Liam Bennett in quick succession on 23 minutes. Stockton was the first to see an effort blocked and the ball rebounded to Arthur Gnahoua but his effort lacked conviction allowing Bennett to make another clearance.
Adam Phillips then tested home keeper Dimitar Mitov with a first-time shot from Gibson's superb cross-field ball as the Shrimps looked threatening. At the other end, Cambridge were denied by Trevor Carson who made a stunning save from Ironside's close-range effort.
After Cambridge went 2-1 up the Shrimps enjoyed a greater share of possession but were wasteful in good positions time and time again. Phillips twice went for glory when he should have looked for team-mates and the final ball was way off the mark far too often from too many players.
As a result the Shrimps only tested Mitov once when Stockton produced a deft overhead kick which the keeper had to turn over the bar at full stretch in the final minute of normal time.
The defeat left the Shrimps out of the relegation zone on goal difference with Fleetwood losing to Accrington and Gillingham drawing against Wycombe, meaning there is still all to play for over the coming Easter fixtures with just four games of the season remaining.
Cambridge: Mitov, Bennett, Sherring (Okedina 71), Jones, Iredale (Dunk 82), Digby, Simper, Smith, Knibbs, Brophy (Hoolahan 65), Ironside. Subs not used: Mannion, Lankerster, May, Tracey.
Morecambe: Carson, Leigh, Bedeau, Bennett (McLoughlin 82), Gibson, Fane, Wildig (Obika 82), Gnahoua (Ayunga 67), Phillips, Connolly, Stockton. Subs not used: Smith, Cooney, Diagouraga, Mensah.
Ref: C. Boyeson.