Agents suggest an average length of 35,000 words and strongly suggest that unpublished or unestablished writers stay close to this average to increase the chances of a larger reading audience and to keep printing and shipping costs down. This might be crummy to read, but publishers are running a business.
You can use the above information as a guide or break the rules like J.K. Rowling. She went the traditional publishing route, so her word counts are more for reference.
Harry Potter and the Sorcerer’s Stone is 76,944 words. Though, as her first novel, it was the shortest of the series.
Harry Potter and the Chamber of Secrets – 85,141. Harry Potter and The Prisoner of Azkaban – 107,253. Harry Potter and the Goblet of Fire – 190,637. Harry Potter and the Order of the Phoenix – 257,045. Harry Potter and the Half-Blood Prince – 168,923. Harry Potter and the Deathly Hallows ~ 198,227.
Once Rowling established herself, she boldly went way beyond the MG suggested word count. For newbie writers, I gently suggest not exceeding 60,000 words in a Middle Grade novel and sticking closer to the average of 35,000 words even.
Many authors, whether traditionally or self-published, break all sorts of rules and have great success. Consider the above, but if you believe in what you’ve written, then go with it!