I'm an open source software developer with many years of experience. This phrase is used a lot in open source, IT, and specifically computer support.
1) Is the phrase "When breaks, you get to keep both pieces" a common one? If so, how is it usually used?
It is a common phrase between professional geeks in IT. It is used to indicate that certain combinations of software/hardware/equipment are incompatible, and may lead to irreversible damage. It is also an indication that one doesn't want to provide support for something that is deemed unstable / unsupportable.
I think the closest non-geeky way to say the same thing would be: "If you go down this path, you are on your own."
Alice: Will all of our company internal software still work for me, if I upgrade to Windows 10?
Bob: If it breaks, you'll get to keep both pieces.
2-days later
Alice: I've upgraded to Windows 10, and also upgraded Office, and now any documents I edit cannot be later opened by anybody else on the team with older laptops. I have a deadline, can you fix this?
Bob: No, I told you, if it breaks, you'll get to keep both pieces.
What Bob is trying to say is "I told you so", "go away", "you are on your own", and "it's not my problem". Thus it's a generic excuse. Sometimes it comes across as patronizing, especially when it later turns out that it's a real problem which should have been supported/working, instead it was dismissed by Bob. That would be called a bug denial.
2) Does 'both pieces' means 'two pieces' here?
It means all the pieces that are broken, kind of equivalent of "don't do that" when asking a doctor why it hurts when you do a particular action.
3) Is it supposed to be playful in tone? Is there any other implied meaning based on the context?
Well, it can be used in any tone one likes from nice to angry. The phrase is informal by nature, but it's not a joke. One seriously means it as a caution / warning. This can go on:
Carol: Bob, did anybody upgrade to windows 10 yet?
Bob: Only Alice, and it broke Office for her. But you know, she got to keep both pieces.
Carol: Well, I don't use that. Here be dragons.
Carol heard the warning, accepts responsibility for any fallout, and goes ahead with the upgrade to see what happens (and breaks).