Pakistan led 2-1 at half-time before extending its advantage in the second half. Rana Waheed scored a hat-trick, while Sufyan Khan netted two goals. Ghaznfar Ali and Muhammad Imad scored one goal each.
Pakistan finished second in Pool B with 12 points, while Malaysia topped the group with 15 points.
Pakistan won four of its five pool matches and suffered its only defeat against Malaysia.
The Pakistani team scored 28 goals across its five pool matches and conceded eight.
With the victory over Oman, Pakistan secured its place in the semi-finals of the Asian Games hockey tournament.