"The Halloween Tree" (1993 TV movie)
Wikipedia synopsis excerpt:
Moundshroud, holding Pip's pumpkin, tells the children they did not make it in time and Pip is now his property, symbolized by his pumpkin. The children, eager to have their friend back, bargain a year from each of their lives in exchange for Pip's. Moundshroud accepts the deal and takes a sugar-skull with Pip's name on it, breaking it into four pieces, and has each of them eat it to seal the bargain. They are then immediately teleported home and realize that the ordeal took all night, but was not a dream at all as they first started to suspect.
Here's a clip from the movie: http://www.youtube.com/watch?v=Be8vfy2pOcY