Okay kids, I know you are broken up inside and in tears right now, but listen up closely. This is the simplest guide for what you did wrong with your relationship and why it broke up.
For men:
What you should not do: You are too needy, want her all to yourself all the time, get jealous at the dumbest things, you need to stop basing your whole life around her.
What you should do: Be more assertive, find hobbies for yourself that doesn't include her, let her have her space.
For women:
What you should not do: Get too needy, become physically unattractive (gaining weight), withholding sex
What you should do: Give him sex and lots of it, that way he won't need to go to another woman for it. Unless she's more attractive than you, then he might go regardless.