A brace from Jafri Firdaus Chew and a deflected effort from Adib Zainuddin helped Malaysia confirm top spot in Group A of the Southeast (SEA) Asian Games after a 3-1 triumph over Laos on Wednesday night.
The 2011 champions overcame a nervous first half when they allowed Laos to equalise by completing a perfect record of four wins in four matches.
They had earlier taken care of Brunei and Singapore with 2-1 victories before strolling past their toughest opponents Myanmar 3-1 on Monday.
As expected, Malaysia coach Ong Kim Swee gave starts to Syahmi Safari, Syafiq Ahmad and Danier Amier, all of whom were benchwarmers from the last game.
But Ong stuck with his hot shot forward N. Thanabalan, who has been on fire with three goals so far in the competition.
Midway through the first half, Malaysia's first real opportunity to take the lead arrived.
Jafri's steaming run and cross from the right found Syafiq Ahmad, but the Kedah forward muffed the chance by slicing wide.
However, the pair combined to great effect to put Malaysia ahead in the 26th minute.
Syafiq's header from Syahmi's cross hit the bar, and Jafri was quickest to react from the follow up and steer home into the bottom corner.
The hosts' joy was shortlived as Laos drew level five minutes later through Phanthavong Thanin.
The midfielder gave Ifwat Akmal no chance with a delicious free kick that went in off the post to make it 1-1.
Malaysia's response was to regain their lead in the 38th minute, through a somewhat fortuitous strike from Adib.
The captain's inswinging cross from the right flank eluded everyone, including Laos goalkeeper Paseuth Saymanolinh, with a slight deflection to nestle in the net.
The second half played out in similar fashion to the first, with the home side not pressing too hard to extend their lead.
Fortunately for them, Laos lacked quality in the final third. And when they did fashion decent half chances, the visitors wasted them.
Thanabalan received a warm response from the crowd of about 35,000 fans after being replaced by Akhyar Rashid.
There was even bigger cheer from the faithful in added time as Jafri smashed home Syafiq's low cross to seal top spot.
Malaysia could now either face Vietnam, Thailand or Indonesia in the semifinals on Saturday after Group B draws to a dramatic conclusion on Thursday.
In the other Group A game on Wednesday, a fortuitous own goal from Brunei 15 minutes from time ensured Singapore ended their 2017 SEA Games campaign with a second straight win.
Brunei goalkeeper Ishyra Asmin Jabidi produced a super showing to keep the score down, but he was unable to prevent his own centre-back Khalid Wassadisalleh Mahmud from putting in at the wrong end.
The Young Lions ended their campaign with six points from four matches to finish third in Group A behind Malaysia and Mynamar.
Malaysia: Ifwat Akmal (GK), Syazwan Zaipol Bahari, Adib Zainuddin (C), Syahmi Safari, Amirul Hisyam Awang Kechik, Jafri Firdaus Chew, N. Thanabalan (Akhyar Rashid 71'), Ariff Farhan (Syazwan Andik 76'), Daniel Amier, Irfan Zakaria (Adam Nor Azlin 64'), Syafiq Ahmad
Laos: Paseuth Saymamolinh (GK), Somphoupheth Santi, Sonthanalay Khampanh, Phanthavong Thanin, Phommathep Phathana, Natphasoul Soukchinda, Phaphakdy Anouwath, Sipasong Bounthavy (C), Lounlasy Lathasay, Kongmathilath Phithack, Khochalern Phoutthasay