More money, more problems: That’s one of the pitfalls of entering the now record-breaking Mega Millions jackpot, which has swelled to $540 million. (Update: Now $640 million!)

Co-workers around the country are entering their office pools in droves, contributing money toward buying dozens of tickets, with the intention of splitting the winnings if one of them were to have the lucky numbers. But because the chances of winning are slim (1 in 176 million), few consider the legal pitfalls they could encounter if one ticket in the pool were to hit the jackpot.

If you and your family, friends or co-workers are pooling together for your chance at a piece of nearly half a billion dollars, here’s what you need to know to protect yourself from future lawsuits.

View Photo Gallery: With the multistate Mega Millions jackpot set to reach a world-record $540 million Friday, lottery players across the country are wondering if there’s a way to guarantee becoming an overnight multimillionaire.

1. Choose a leader. The LA Times’ Rene Lynch says that office pools work better when one person — someone trustworthy, of course! — is in charge. This person should collect the money, buy the tickets and facilitate the pool. He or she should also let the group know beforehand about any personal lottery ticket purchases. This is important, because many lotto-winning lawsuits come from poolers who bought tickets with a pool, but then said they bought the tickets on their own.

2. Make sure the agreement is in writing. Be sure to articulate who is in the pool. The bigger the pool, the better the odds — but if more people are included, each takes away less. Be sure to also decide on provisions for people who may be regular office pool contributors, but may be on vacation or out sick — are they included?

“You really want to eliminate any possibility of someone saying, ‘I should have been included and was not,’ ” attorney Eric Kahn, who represented construction workers who sued a co-worker for a cut of $38.5 million in lottery winnings, told SmartMoney.

3. Make sure that everyone who put in cash gets a copy of the tickets. This is the most important step, and the best way to ensure that any personal ticket purchases are separate from the pool. The pool leader should make copies of all tickets, and distribute them to the entire pool before the drawing. This includes the front and back of the tickets, where the serial numbers are.

After that, all that’s left to decide is what you’ll do with the cash if you win. Perhaps consider taking the co-workers who didn’t enter the pool out for a drink — they’ll be having a bad week.