As soon as it becomes clear that you and your ex need to keep living together, you must sit down and have a conversation about your relationship. Make it clear that you aren't interested in keeping the relationship going and that you don't want to keep dating the person. It might sound strange, but the last thing you want is for either of you to feel any hope in regards to the relationship.
After you have the talk, it's time to lay down some ground rules. The first thing to address is the situation with the bills. When you were dating, it may have been easy for one of you to slack off around bill time. Maybe you paid the water bill, when his paycheck came late or maybe she covered the rent one month when you had other things to worry about. That relationship is now a thing of the past and it's time to start acting like roommates.
Write out a list of monthly bills, including water, electric, rent and cable or internet. Estimate the size of the bills for each month and write out the due date for each one. Then, divide the bills in half. Make sure that you ex knows that each bill is due on a specific date and you expect their share of the bills by the due date.
You also need to look at your relationship in regards to the shared living space. It's much easier if you have a two-bedroom place and you each have your own separate space. If you're sharing a one-bedroom home, then you need to figure out a way to divide the space. Don't expect your ex to pay half the rent, when you take over the only bedroom and he's relegated to sleeping on the couch. By the same token, divide up closet space.
Depending on how bad the breakup was, you may even need to divide up the apartment or house. Make up a schedule that shows when each of you has private time in the residence or time to spend with friends. You may not think you have to worry about this, until you come home and find your ex and multiple friends having a late night party.
Lastly, you absolutely must go over your relationship and how it's changed. Sleeping with your ex or even sharing a bed together is a bad decision. It blurs the line between roommates and having a relationship. Being friends with your ex is a good thing in this situation, but when you blur that line, it's sometimes hard to remember why you broke up. You also need to change your own expectations of the relationship and remember that you're no longer a couple. When you see the person day in and day out, you might start to feel those old feelings. Giving your ex a goodbye kiss or goodnight kiss starts a dangerous path down that slippery slope.
In addition to discussing your own relationship, you must discuss future relationships. Now that you're no longer a couple, you're both free to date other people. While that may sound good in theory, how will you feel if you come home from work and discover your ex on a date? Or worse, your ex never comes home one night? Be upfront about your feelings from the very beginning and broach the topic of dating other people. Only then will you truly feel better about your living situation.