i'm sorry you're having problems in your marriage... its so sad to have something that was once so beautiful and blessed become so difficult... i can tell you that divorce is never an "easy" way out, if its possible to salvage things, that's going to be so much better for all involved in the long run... but sometimes if divorce is the only way, then getting a good family law lawyer is your best step. (I know a great one in western new york if you'd like her name, but i'm not sure where you're located)
my husband had a great lawyer who helped fix all the custody problems he was having with his ex over their daughter. and, like almost everyone else said, unless your husband is abusive or dangerous to your children they will never award you SOLE custody... you may be able to get residential custody where the children live with you but visit your husband. The frequency and timing of that is something that depends - on how far he lives, how much you each work, or just on the judge you get - sometimes it's 50%/50%, sometimes they live primarily with one and alternate weekends and holidays between parents, sometimes they split the summers 50/50 but less during the school year - there's so many combinations that i've seen, but its different for everyone... either you can work it out with him or the courts can appoint it if you thing you won't be able to to a fair compromise.
And as someone said - "legal" custody is different. That refers to how much say you each have in the children's life... either you'll be able to make decisions without his approval or you have to both agree... it all depends on what you both want or what the courts tell you you have to do.
As long as they are not in any danger, it is only fair to your children to allow them access to both parents... it will definitely be difficult on you (its definitely not easy on my husband not getting to see his own daughter every day, and dealing with his ex can be horrible sometimes), but the children are the important ones in the situation and you have to consider their feelings on this too. it will change all your lives probably more than you can imagine!!
good luck with everything and let us know how it goes.