Dont forget the Xbox One S is now what the PS3 was at start, a "cheap" 4k Blueray player for most buyers.But they have never bought Xbox in numbers similar to the Playstation in the three generations there have been an Xbox.
As for this generation the reasons are simple. E3 and before announcements for the Xbox one were PR nightmares, outright disasters. Sony first PS4 E3 was basically the perfect one. First they saw how Microsoft were shooting themselves in both feet and basically won by saying "The way you share your games with friends or sell/buy second hand games will not change."
Fast Forward to present day the damage is done. With 3 consoles on the market Sony holds about 55% globally. Microsoft have all but given up trying to compete with the whole "Buy this on Xbox one and you'll get to play it on PC too." basically telling PC owners not to bother buying the Xbox one. Since that means Xbox one has 0 exclusives, meanwhile PS4 exclusives are not going on the PC. At least until the PS streaming service starts putting up PS4 games.