This poem is written as advice and a warning. The speaker is explaining to his son the importance of not acting in such a manner as to prevent the joining together of the "three things" that are symbolically named.
The first thing is "the Wood," by which the speaker is referring to the raw material that could be used to build a scaffold or the tree that could be used for a gallows.
Secondly, "the Weed" stands for the hemp plant, whose fibers are used to make rope that can then become a noose around a person's neck.
The third thing is "the Wag" - the "wild" individual who might influence an innocent without the victim's awareness into trouble.
The speaker admonishes "my pretty knave," meaning my young son, to beware of following where the "Wag" attempts to lead. If the son should follow "the Wag" to a place where the "three things" gather together at the same time, it would mean that the child was being hung.