Chasing 360 for victory, Darren Lehmann's South Australians were 14 for three heading into Friday's fourth and final day.
Lee had former Test opener Matthew Elliott leg before wicket for a duck, McGrath had Shane Deitz lbw for two and nightwatchman Cullen Bailey was bowled by MacGill for a duck.
Former Test batsman Greg Blewett was unbeaten on 11 with skipper Lehmann next to come into bat.
NSW captain Simon Katich declared his side's second innings closed at 187 for two.
After his first innings of 144, Test batsman Katich was unbeaten on 79 and opener Phil Jaques added 66 to his 69 in the first innings.
Lehmann earlier produced a stylish 159 but it wasn't enough to prevent NSW from taking a first innings lead of 172.
Lee (4-77), McGrath (2-46) and MacGill (3-131) bowled SA out for 343.
New South Wales 515 for 9 declared (S. Katich 144, M. Clarke 178, P. Jaques 69; D. Cullen 4-149, P. Rofe 3-109) and 187 for 2 declared (S. Katich 79 not out, P. Jaques 66) v South Australia 343 (D. Lehmann 159, M. Cleary 52; B. Lee 4-77, S. MacGill 3-131) and 14 for 3 (G. Blewett 11 not out; B. Lee 1-1, S. MacGill 1-1, G. McGrath 1-5).