In the past when I have done the Royal Day Out, I arranged the time for the Queens Gallery 1st thing, then did the Mews, took a break for lunch and did the Palace last. They route you to exit the Palace thru the gardens (looking at Google maps it looks like you exit on Grosvenor Pl.). It is a fair piece back to the Queens Gallery.
editing to add: The entrances to the State Rooms, The Queens Gallery and The Mews are all on the same street. Both the Mews and Gallery exit you back on to this street.
Both times I have gone I was very interested in the showing at the Queens Gallery so I listened to the whole audio tour. I did try to get to the Mews for their free guided tours at 11, so probably spent 1h30m at Queens Gallery or a little less so I could walk next door for the Mews tour, then maybe an hour or a bit more in the Mews as you will want to look around a little before or after.
After seeing those 2 areas, I did want to sit down for a bit so lunch was a good break. I asked the ladies in the Mews gift shop (thru which you have to exit, lol) about a lunch place and was sent to fairly good restaurants both times. So, lunch and then back to Buckingham Palace for the State rooms. That probably took me 1.5 to 2 hours. They have a nice little tea room/tent at the end and who can't resist having tea at the Palace?
By the way, if you or your group are NOT interested in the special showing at the Queens Gallery, I would skip it. I have not looked to see what is on this year. Last year it was The Georgians, the year before The Tudors. In my experience it is only the special show that you see, nothing else.
editing: OK, this year the exhibit is The Art of the Garden which looks like something I would like but may not be to everyone's taste.
http://www.royalcollection.org.uk/exhibitions/painting-paradise-the-art-of-the-garden-bp