Aequitas's comment contains a link to the strategies page of the Terraria Gamepedia, here, this page contains most of what you would need in regards to tips and possible setups for the Moon Lord. That said, the wiki guides may be a bit cumbersome to read, and sometimes a more condensed guide could be useful. Before reading this, take into consideration that beating a boss is supposed to be a challenge and to be fun. So plan your strategy in accordance to that. And now, here are my two cents.
As usual with Terraria bosses a small arena before the boss fight is almost necessary. The layout may differ depending on how you plan to handle the Moon Lord. If you want to beat it in a vanilla way, then a 60-80 tile platform with 4 campfires and 4 heart lanterns is enough. You may add a bit of honey for extra regeneration, but the Moon Bite debuff nullifies regen, so I think is not worth it.
You can also implement a "blockade" style of arena, that is, add some blocks over your head and/or on the sides to prevent the non-piercing attacks. This will prevent a lot of the damage, but it will be cumbersome when attacking the boss. and you will need some special weapons, for example a bow with Holy Arrows, for their "star falling" capabilities.
Additionally you can implement a minecart rail arena. Which is basically and arena where you will fight the Moon Lord while riding a minecart. With the rails ends hammered to "bumper", to allow bumping at the end of the rail. This allows you to move very fast and thus a lot of attacks from the moon lord will miss.
Now depending on the Arena chosen these statues may be crucial to the fight. In a vanilla style Arena, you will not be able to maintain you HP with potions alone, at least not with pre Moon Lord gear. Either you deal a lot of damage and die during the second stage; or you deal little damage and die from running out of gas. So for the vanilla Arena you need 4 statues at least, wired to a timer.
Keep in mind however that the statues spawn hearts depending on the current hearts dropped all around the world, so if you just beat the last pillar be sure to pick up the hearts from the pillar mobs, or the statues may not spawn hearts.
I believe the heart statues may not be necessary while using a minecart arena. since the cart goes really fast. So there are setups that do not require the statues because of the dodge chance they provide.
First, melee characters have a disadvantage with this boss because of its movement patters, so you can go caster, summoner or ranger.
I tried summoner, and it worked great on the first stage while using Tiki Armor and a Stardust Cell Staff. However by the second stage the True Eyes of Cthulhu were dealing too much damage for the armor defense, and thus I didn't survive the battle. I still think is a viable strategy, but with constant Phantasm support(I was using MegaShark that time).
I don't know much about caster. However, considering the main bonus of the caster armor at that point (the healing) is negated by the Moon Bite debuff, it may be better to consider other classes instead.
Finally ranger has Shroomite Armor, the armor itself doesn't have a lot of defense but its bonuses may prove to be very useful when fighting the boss. Remember the headgear should be different depending on the weapon chosen. As far as I know, this is the best class to fight the Moon Lord, due tho its movement patters and size of the boss.
First of all, all your equipment should be reforged to "Warding", defense is really important against this boss, as you will be constantly receiving damage. That is, unless you are playing a dodge strategy, then it depends on such strategy.
Considering the defense is really important you need a Paladin shield and an Ankh shield for raw defense, you may replace one of the shields with a Worm Scarf, if you don't have any problem with using expert items in non-expert worlds(I didn't).
A crucial item is a Star Veil, or a Cross Necklace if you don't have one. The normal invincibility frames are of 1.5 seconds after receiving damage, when using these items those frames are increased to 3 seconds. this will allow you to receive tons less of hits, considering the Moon Lord is constantly attacking, specially in its second phase.
Another important Item is a Charm of Myths, the usual potion cooldown is of 1 minute, this item allows you to have a cooldown of 45 seconds, along with increased life regen. Those 15 seconds can very well save you from dying.
Finally, you need an emblem according to the class you chose, remember to have it with Warding prefix. However if you're using a Phantasm you may prefer a Magic Quiver because of the arrow speed, which will help a lot. Or you could have both and remove one of the above in which case I'd recommend removing the Charm of Myths, although you will rely more on heart statues.
Oh yeah, and you need an UFO mount, no question there, Wings require a slot, the UFO mount doesn't.
I can only provide reliable information about ranger here. In that case the choice is a Phantasm with and Endless Quiver. You can use holy arrows which are of course much more effective, but they are expensive, and it will hurt you when they don't hit. So better go with endless and just "shoot all the things". Unless you have tons of holy arrows, but given the appearance of Unicorns I don't think that's the case.
I also used a Megashark with Crystal bullets the first time I beat it, and it worked well although it was much slower.
Finally I'd recommend crafting a Stardust Cell staff, even while not being a summoner, with the buffs written below you can have 3 cells running around doing extra damage, which are great help.
- Greater Healing Potion(or Super Healing potion if you can afford it).
- Archery Potion(Better archery if you're using a bow of course).
- Endurance Potion(Reduces damage taken by 10%).
- Wrath Potion(Increases damage by 10%).
- Rage Potion(Increases critical strike chance by 10%)
- Regeneration Potion(More health regen)
- Heartreach Potion(Increases pickup range for life hearts, important for statues)
- Ironskin Potion(Increases Defense by 8)
- Lifeforce Potion(Increases max life by 20%)
- Summoning Potion(+1 Minion capacity)
- Bewitching Table(Not potion, furniture buff, +1 Minion capacity)
Remember to "rebuff" yourself from time to time, the potions have different lasting times so you should start rebuffing after 4 minutes. Don't worry about wasting your potions, if you are already buffed the potion won't apply.
- If you see impeding doom approaching, that is the head laser, try to get hit by another projectile so the laser hits while the invincibility is active.
- It's hard to dodge the laser, however keep in mind that the closer you are to the head, the easier it will be to circle over it's head, thus dodging the laser.
- Deal damage to the three parts simultaneously, and then destroy the three of them when they are all on low HP. The True eyes of Cthulhu are invincible and deal a lot of damage, so the longer you can be without them, the better.
- The focus of the battle should not be the three parts of boss, it should be on the tongue, you keep your eyes on that tongue to be ready to kill the white essences that heal 1000 hp each. There will be three of them per tongue attack. That's the priority, when you killed the three essences, attack the parts.
- Keep shooting, specially with the Phantasm.
- When the Moon Lord is on the second stage, keep moving wildly, do not pay attention to the attacks, just move around to dodge the most you can, while on the other hand do not take your aim off the Moon Lord core, once in this stage you need to be quick, or the Eyes will overwhelm you.
And that's it. Personally I think it's the best boss, so much craziness, and yeah it's really hard, but it's good to see a challenge again.