This may seem like really simple advice, but people need to hear what Dr. Brian Parker is saying here. Guys can and do lose erections all the time, even in the throes of passionate fucking. It may feel fantastic, but if the mind wanders, so can the blood flow.
Personally speaking, this didn’t really start happening until a couple of years ago, and it was disconcerting at first. Not only for me, but for my partner as well. If someone is putting out or performing sexual acts on you, he or she may naturally get confused and then internalize feelings of inadequacy. He or she may think you don’t like the sex that is happening.
But you both just need to slow down, regroup and get your heads in the game (terrible sports reference). The dude needs to get his mind of work/family/friends/sports/whatever and get back in the sexy moment. Partner needs to remember that unless he says so, he likes it. Even if it means switching to another activity for a little while to re-engage.