It is normal for a 2 yo to be clingy even when they're in an intact family given lots of a love. Your boyfriend's son is passed back and forth between his mother and his father. And, his father, pushes him away. This boy is afraid because he feels so very insecure. And the more he's pushed away the more he will cry to be held.
Think about the fact that at 2 a child is 100% dependent on adults for his very survival. He knows, instinctively, that if someone doesn't want him or acts like he doesn't want him his life is in danger. We're all born with the need to be loved and cared for. That means we need attention.
Yes, it is difficult to deal with a baby that clings and cries but doing so is required of parents. I'm glad you're asking for ways to fix this. First there is no easy way. This baby is already insecure. You don't mention what his life was like before this. Was he fed when he was hungry? Were his diapers changed when they were soiled? And most importantly of all was he held when he cried. Or was he left in a crib and taken care of when it fit with the adult's life? If he had an insecure life it will take a long time for him to learn to feel secure. In fact, he's missed the optimum time during which a sense of security is learned.
What you can do now, is have his father hold him all of the time. The father can eat while he's holding him. He can do almost everything while holding his son. His father needs to show him by his attitude that his baby boy is very important to him and that he wants him in his life.
You can be patient and loving with them both. Spend time with the son, playing with him when his father isn't there and when he is, showing him that he's important to you. It will take time for him to warm up to you. Give him time. Be patient.
And never let him cry for hours. Hold him while he cries so that he feels safe. Have you never been upset and cried for hours because there was no one to hold you? If not, I'll tell you, from my experience that it's very scary. I felt so very alone and helpless and I was an adult who knew I would be OK.
When he feels loved and secure he will stop crying and clinging. This is a normal stage made worse by his experiences of being shuttled back and forth between mom and dad and everything else that went on during the parent's relationship and separation. When you guys lose patience with him his fright goes up another notch. He's feeling that maybe no one will love him enough to give him what he needs.
I guarantee that if this baby doesn't get the attention he needs now he will be an angry out of control little boy. For that reason I urge you to look into parenting classes for the two of you as well as therapy for all 4 of you.