The one area they had a lead in they squandered twice. Although it finished in largely a draw, the Xbox 360 had a huge lead over the PlayStation 3 in terms of price, software, networking and release.
The 360 eventually morphed into a users' entertainment hub and so the Xbox One was launched on this basis only MS failed to see that it was because of the games and not the features. The PS4 stormed ahead as 'just' a games console despite having feature parity with the X1.
Rather than looking at why Sony was still beating them at every turn (better exclusive titles) Xbox closed most of their own studios and instead bundled their games into a sub. The Series X console since launched with no exclusive titles, too much emphasis on the sub and so away goes the PS5 in sales.
MS have sinced forked out $billions on studios to get back more exclusives and it hasn't worked.