I must first caution, no matter how tense the situation may be around the house, do NOT move out of the house & leave the kids with the other parent. This will automatically put you behind the 8-ball in winning custody.
Additionally, if you haven't been already, take an active part in EVERYTHING the children are involved in. Make sure his/her teachers, doctors, extracurricular activity instructors, etc. know you by your first name.
If you presently work long hours, cut it out immediately. Spend the extra time with your kids. Take them fun places & buy them nice gifts (though caution must used not to over-do it as it otherwise would look like you're trying the bribe them).
Keep a written diary of any important conversations or interactions with the other parent (a "he-said-she-said" log). Refrain from posting negative content about the other parent on social media as this is potentially discoverable - if you have something to say to a friend/family member, say it in person. Refrain from cursing or denigrating the other parent, especially in writing (I don't know how many cases I have in which one side curses or denigrates the other via text and/or e-mail).
Finally, consult a good Child Custody lawyer in your area.