I remember reading an article written by an editor (don't remember their name), and it was about writers who have fantastic ideas, a great beginning, and an incredible ending but a sagging middle. The editor complained that the writer seemed to get lost after the first two chapters and didn't find their way until they got to the end. So how do we prevent middles that go nowhere?
1. Create a Good Outline: If you have a solid outline with all of your sub-plots worked out, you shouldn't have this problem. I realize a lot of writers don't want to do in-depth outlines for some reason. Perhaps they feel it squashes their creativity. I don't know, but I love them and couldn't write an entire series without them.
Now, I'm not saying I follow them to the letter, because I don't, but it's nice to be able to see where I am going.
2. Sub-plots: While you are working out your main story, don't forget about sub-plots. An extra problem here and there for your protagonist can help make the story more interesting and carry it to the end.
3. Character Development: If done correctly, this can fill in a great deal of the story and keep you on target. I know being boring is a sin, but sometimes a conversation between two characters without any bombs exploding is a good thing. Your characters need time to grow and change. A character who finishes the same as he/she began is not a fully-developed character.
I don't know who first said this, but I'm sure you've heard it. Put your character in a tree. Throw rocks at him. Then help him to get down. Writers seem to have trouble with the throwing of rocks. Not me. I've never had a complaint about the middle of my books. Although, I've gotten a few complaints about characters in Vampires Rule. Some people wanted to see more scenes between certain characters, but I have two more books coming out with those characters and had to save something for then. Happy writing!