You can learn to stay in your body.
In other words, pay attention to how it feels in your body from moment to moment as you're listening. If you want, you can just choose one place, such as your belly. I like to use the soles of my feet and how they feel on the ground.
So put about half your attention on the experience of what's going on within your body.
That'll keep you grounded, or present within your experience.
Then, put the other half of your attention on the act of listening. Think of listening as work. It's work that requires you to focus and concentrate.
With thoughts that arise in your mind, just drop them or let them go. That's part of the work of listening.
Naturally, I prefer to engage with those with whom listening isn't such a chore. But it's also good practice to engage with people who aren't so entertaining either. It's good practice in letting go. Letting go of one's thoughts. They're not so important anyways.
That'll serve you in all areas of your life, especially when you're alone. You'll learn not to take your own thoughts so seriously.
So think of the work of listening as a practice in letting go of the importance of your own thoughts.
If you're worried that people will think that you're only giving them half your attention, don't. Most people aren't paying good attention to you when they're yapping away anyways, and my experience is that by staying within my own experience or my own ground (i.e., bodily experience), I can actually help anchor them into their own experience.
And you know what? Most people are really only looking to more intimately connect to their experience of living. They can talk and think all day long, but it's only when they connect to their (lived) experience that they come home to themselves, to who they are.
So you're doing them a service by you staying home within your body while also listening.