That age is just tough–I feel for you! My son was so busy at that age! Luckily, once he turned 3, things got a bit easier.
We were able to get some success by having special “church toys” and “church books.” We bought him one of those etch-o-sketches, which he ended up loving! We put it away during the week and only brought it out when we went to church. It helped keep the toy new and exciting for him, so he would be more willing to sit and draw on it. We also found some bible books that have the little flaps that he could open up. Again, this book was set aside during the week, and he only got to look at it during church.
We brought some small snacks that helped keep him entertained. Just simple things like cheerios worked great for him. At one point, we bought the fruity cheerios for him and let him have them only at church. It gave him something to look forward to during the week.
He would still act out and end up in time out sometimes. We found the best way to do it was for one person to take him out and have him sit still. We wouldn’t carry him, he just had to sit still and be quiet. We would talk to him and explain that he could either sit still and be quiet in time out, or he could go back into church and read his book or play quietly. It took a few tries and some practice, but he eventually decided that he would rather have the freedom to move around a bit rather than sit on the floor. Also, we were careful not to let time out last too long, because at one point he was asking to be taken out to time out. The important thing was to help him understand that he was expected to be inside the church with us during Mass, and that bad behavior is unacceptable. It did take a few tries and lots of practice, so be patient!
Someone mentioned bribing the kids with doughnuts after Mass if they behave. This has worked wonders for us as well! It doesn’t always have to be food, either. My son loves to feed the ducks at the local pond, so sometimes we will bribe him with a trip there. Hope some of this helps you, and good luck!