Depends on what metric you want to use.
Market share? Basically a tie. Sony slightly ahead on hardware and Microsoft slightly ahead on software. Basically a tie.
Profits? They both lost a ton over the course of the generation. (While Nintendo made record profits.) Again basically a tie.
Which one accomplished their goals? This is the most interesting metric. Sony had several goals for the PS3:
1) Continue the success of the PS2.
2) Make Blu-Ray the dominant disc format.
3) Develop the PS3 with PC-like capabilities effectively putting a Sony PC in every gamer's living room.
In contrast, Microsoft only had one goal: Stop Sony from accomplishing their #3 goal, which is a threat to Microsoft's core business.
How did they do? Sony accomplished their #2 goal. They didn't accomplish #1 and #3. Microsoft, on the other hand accomplished their only real goal. PS3 started out with a lot of features that Sony eventually removed. Among these were having 4 USB ports and being Red Hat Linux capable. (PS3 also had other PC-like features that didn't get removed like an internet browser.) The USB ports soon got scaled down to 2 and Sony removed their Linux capability. The latter feature is really the big one, because you can't really have a PC without an OS. (Also they pissed some hackers off by doing this and Sony's system got hacked.)
In the end, I have to give it to Microsoft. They accomplished their only one goal. Sony, on the other hand went into Generation 7 overconfident and they got seriously humbled. Among the 2 losers of Generation 7, Microsoft is the winner.