Agarkar exploited the overcast conditions to grab three for 41 to reduce Gloucestershire to 133 for four by stumps on a truncated day at Lord's.Opener Phil Weston was unbeaten on 39 from 140 balls with SJ Adshead on nine.
Agarkar struck his first blow when he had Mike Hussey caught in the deep to break a 79-run second wicket partnership between the Australian and Weston.
He then followed it up with wickets of Chris Taylor and Alex Gidman to justify captain Ben Hutton's decision to bowl first.
Middlesex had reasons to feel aggrieved after Cricket Australia prevented McGrath from playing for the County club once again.
McGrath is easing his way back into international cricket after an ankle surgery kept him out of the 2004 home season.
He returned to action during Australia's two-Test series against Sri Lanka at home this southern winter.