Keep focused on the game
When I first started GMing years ago I ran into this problem rather frequently: An in-character action resulted in an out-of-game movie one liner, and then the game unexpectedly paused for several minutes while the group discussed the movie in question. I found a few easy tricks that worked surprisingly well to keep players focused without making it feel like I was punishing them for socializing instead of playing.
Plan for it
A lot of groups only get together once a week or even less, so naturally everyone wants a chance to reconnect with their friends.
Plan for this, and schedule an extra half hour before the game where everyone can hang out and socialize while you finish prepping any last minute details, wait for the pizza to arrive and set up the gaming table. Let people have some time to reconnect before starting the session to to keep the group focused on the adventure rather than trying to fill in everyone on the cool weekend they had.
Another variation for longer sessions is to call for 10-15 minute snack breaks every couple hours or so to give everyone a chance to stretch their legs and socialize a bit before resuming the session. (It also lets the GM review notes for the next scene, if needed, and make any last minute changes.)
Keep up the pace
When the pace slows, so to does player focus on the game, which can lead to players striking up conversations with others at the table while the GM looks up rules, reads over notes, or focuses on a single person who is away from the rest of the group.
The easiest solution is to keep scenes from dragging on endlessly, and try to keep all players involved in the scene somehow. This doesn’t mean every scene has to have conflict, but every character should have something meaningful to do during a scene other then stand around on lookout while others search for evidence or interview witnesses. As long as they contribute in some way that’s engaging to the player, their focus will remain on the scene and they will be less likely to strike up out of character convos.
If all else fails, or you simply want to give a nice incentive for good RPing, the GM can hand out small edible “tokens” periodically, (M&M’s and Lifesavers work well, or small pieces of dried fruit or nuts for those of us without a sweet tooth). This gives everyone at the table a tangible incentive to pay attention. Aside from being edible, every x # of tokens earned can equal X amount of experience points to give in-game rewards towards making a good session rather than simply an appetizing one.