Marsh (90 off 107 balls) was bowled by Khurram Shahzad first ball after lunch on day two, bringing an end to an innings that featured 15 fours and one six.
Pat Cummins (9) and Nathan Lyon (5) followed a short time later as Australia lost their last three wickets for 11 runs.Â
Alex Carey (left) walks off after being dismissed by Pakistan paceman Aamir Jamal (centre). (Richard Wainwright/AAP PHOTOS)
Paceman Aamer Jamal was the pick of the Pakistan bowlers, snaring 6-111 in a memorable Test debut.
Marsh cracked 10 boundaries on the way to his 66-ball half-century, and he entered the lunch break needing just 10 more runs for his ton.
But he was gone first ball after lunch when he attempted to drive a Shahzad delivery that jagged off the seam and struck the top of middle stump.Â
Australia started the day at a dominant 5-346 courtesy of David Warner's 164 on Thursday.
The knock all but guaranteed Warner will make it to his planned Test farewell in Sydney in January.
Marsh was careful when he needed to be on Friday, and cashed in with boundaries every time Pakistan's line or length strayed.
Even some of the good balls were put away as he unleashed a wide array of strokes.
The current Test marked Marsh's first at Optus Stadium.
Mitch Marsh celebrates bringing up his half-century on day two of the first Test against Pakistan. (Richard Wainwright/AAP PHOTOS)
In the 32-year-old's most recent Test appearance in Perth - against England at the WACA Ground in 2017 - Marsh cracked his highest Test score of 181.
But there would be no hometown century this time around.
Jamal boldly declared after play on Thursday that his team could bowl Australia out within an hour on Friday.
The 27-year-old had to wait 56 minutes before being chucked the ball on day two, and by that stage Australia had added 60 for the morning.
Jamal's prophesy of snaring Australia's remaining five wickets within an hour may not have come to fruition, but he unleashed a 138km/h pearler with his sixth ball to rattle Alex Carey's off stump.
He collected his fourth wicket when another beauty of a delivery found the outside edge of Mitchell Starc's bat and crashed into the stumps.Â
Marsh was almost run out on 81 following a mix-up with Cummins, with Shaheen Afridi only narrowly missing the stumps from a side-on angle.
Lunch-time ended up stifling Marsh's momentum, with the West Australian's decision to come out blazing after the break backfiring.
6�⃣ wickets for Aamir Jamal! Sixth-best bowling figures by a 🇵🇰 player on Test debut �— Pakistan Cricket (@TheRealPCB) Australia are all out for 487 in their first innings �#AUSvPAK pic.twitter.com/KQSTrfivptDecember 15, 2023
Australia's innings was over 20 minutes later after both  Cummins and Lyon edged Jamal to slip.Â
Jamal roared in delight and then kissed the Optus Stadium turf after claiming his fifth wicket.Â
He raised the ball to warm applause from the crowd as he walked off with his teammates after Australia's innings was brought to a close.Â
Jamal's haul marked the first time an overseas player had taken five wickets on debut in Australia since India's Abid Ali took 6-55 at Adelaide Oval in 1967.