Gills' Rowan Vine had cancelled out Brian Woodall's opener with his first goal in 13 months but Green struck after 73 minutes to all but end the hosts' play-off hopes.
Woodall went close for the visitors early on but his low drive hit the side-netting, although he was not to be denied after 38 minutes when he fired in a loose ball after Abu Ogogo's shot has been parried.
After the break Gills goalkeeper Paulo Gazzaniga made a smart near-post save to deny Josh Parker and the home side levelled after 58 minutes when Vine found space in the box and curled past Chris Lewington.
Chris Whelpdale saw a close-range volley saved by Lewington as Gillingham pressed to take the lead. But Daggers sneaked back in front when substitute Green broke down the right flank, breezed past two defenders and fired in from the edge of the box.
Whelpdale missed a golden opportunity to equalise when he shot wide from inside the area late on as the Daggers went nine points clear of the drop zone with four matches remaining.
Any reproduction, publication or redistribution of this material without the written agreement of 365 Media Group is strictly forbidden.