Pakistan headed to lunch on day four at the MCG at 1-25 after having to bat for nine overs before the break.
Starc had Shafique (four) edging to Usman Khawaja at third slip to end the Pakistan opener's horror match.
Shafique dropped a simple catch in each of Australia's innings, opportunities that cost Pakistan dearly.
The lunch break could have been even more joyful for the home side but for two narrow misses.
Pakistan captain Shan Masood (12no) successfully had an lbw decision against Nathan Lyon overturned, with ball-tracking indicating the delivery was travelling over the stumps.
Starc also put down a tough caught-and-bowled chance to dismiss Imam-ul-Haq, who ended the session unbeaten on five.
Australia were out for 262 in their second innings after losing 4-75 during the morning.
Wicketkeeper Alex Carey (53) helped push Australia's lead over the crucial 300-mark with his highest score since the first Test of the Ashes in June.
Shaheen Afridi took 4-76 in Australia's second innings at the MCG to claim six wickets in the match. (Joel Carrett/AAP PHOTOS)
Star Pakistani quick Shaheen Afridi (4-76) made a welcome return to form with his best figures of the series, while fellow left-armer Mir Hamza (4-32) proved a serious handful.
Pakistan, who have lost 15 successive Tests in Australia, will need to create history to avoid going down 2-0 in the Benaud-Qadir series.
The last team to score more than 300 in the fourth innings of a MCG Test was Pakistan in a losing cause back in 1990.
Pakistan's highest successful Test chase against Australia was back in 1994 when they made 9-315 during a classic in Karachi.
The highest successful fourth-innings chase at the MCG was England's 7-332 in 1928.
Australia captain Pat Cummins was dismissed by Pakistan pacer Aamir Jamal in peculiar fashion on Friday morning.
Cummins was given out by the on-field umpire, but the star quick decided to review the caught-behind decision.
After nothing showed up on hotspot, the original decision eventually stood due to a spike on snicko.
"...What we're looking for is a spike as the ball goes past the bat or up to one frame past the bat which allows that distance between the noise and the stump microphone," former international umpire Simon Taufel told the Seven Network.
Carey's crucial cameo takes pressure off the left-hander, who has been down on form with the bat and was dropped during Australia's ODI World Cup campaign.
Wicketkeeper Alex Carey made 53 as Australia set Pakistan 317 to win the second Test at the MCG. (Joel Carrett/AAP PHOTOS)
Carey followed up on Mitch Marsh's good work on Thursday when the allrounder smashed a sparkling 96.
Marsh joined Steve Smith (50) at the crease when Australia were reeling at 4-16, but the pair put on a potentially matchwinning 153-run stand.
The 32-year-old was given a life when Australia were 4-46 when he was dropped by Shafique in the slips cordon.
Shafique, who also dropped a simple chance on day one, was taken out of first slip on Friday and replaced by Babar Azam.
The former Pakistan captain hung onto a brilliant catch to dismiss Mitchell Starc to help bring Australia's innings to an end.