Don't write that wild adventure only to have it turn out to all have been a dream. Readers will be disappointed, even angry, and editors will disapprove.
Do make your ending believable. Yes, the ending can certainly be a surprise, but it has to make sense within the context of the story.
Don't make the ending too easy. If problem could have been solved anywhere throughout the story by the main character clearing up a misunderstanding, the ending is weak. (TV sitcoms rely on the easily-cleared-up misunderstanding way too often! But that's television comedy.)
Do have the main character be the one who is most affected and who is the one who solves the problem. He/she can have some help, but no magical outside force or overeager parents saving the day, please.
Stop when the story ends. Yes, readers may wish for more, because they've been involved with characters throughout the book and are reluctant to say goodbye to them. But once there's been a resolution to the problem, that's it. It doesn't really hurt to leave the readers wanting more, as long as the story has reached a conclusion.