This sounds like The House with a Clock in Its Walls by John Bellairs
The book begins when the recently orphaned Lewis Barnavelt moves to the town of New Zebedee, Michigan, to live with his mysterious uncle Jonathan Barnavelt. Jonathan turns out to be a mediocre, though well-intentioned, warlock, while his next-door neighbor and good friend, Florence Zimmermann, is a far more powerful good witch. Jonathan's house was previously owned by Isaac and Selenna Izard, a sinister couple who had dedicated their lives to black magic, and plotted to bring about the end of the world. Before dying, Isaac constructed the eponymous clock that he hid somewhere inside the walls of the house, where it eternally ticks, still attempting to pull the world into the magical alignment, which would permit him to destroy it.
Lewis manages to befriend a local boy named Tarby Corrigan, who is everything he is not—popular, athletic, thin, and so on—but the two soon begin to drift apart. Lewis tries to win Tarby back by demonstrating how to raise the dead in the local cemetery on Halloween but only succeeds in releasing Selenna from her tomb. An escalating series of encounters with the sorceress' ghost builds to a final confrontation in the basement of Jonathan's house, where Lewis must summon up his courage and prevent her from finishing her husband's work and bringing about Doomsday.
I recently read one of the other books in the series, about a haunted opera house, so it was fresh in my mind. I don't believe the uncle actually pulls the moon down, but he does do a ritual in his back yard where he eclipses it.