They both do both relatively frequently, Xbox acquiring far more studios overall over the past generation while Sony's leaned more on platform/timed exclusives to support their first party offerings (until more recently).
Some strong second party games might have helped out Xbox this generation, but I don't recall them having tons of success on that front last generation and they have enough internal studios now that they should be able to set themselves up to put out regular first party releases and not really need that second party support.