by mid-late game im guessing ur refering to late industrial to modern era.
gatling/machine guns are key for defending since they have covering fire. cover promotions on fusiliers/riflemen with medic beside them makes it difficult to kill an entire unit unless they commit all their attacks to it. if thats the case just plant down a citadel.
artillery has high range, so use it for chip damage in the backline away from danger. make sure to have antiair nearby so that they wont just die immediately to bombers.
railroads can be a little pricy but they are very important to allow your troops to cycle and heal. u can also have light tanks on the railroads to move in first for chip damage, and then tanks to move in for the kill before backing out.
AIs tend to just push in with everything they have at once, so when that happens just keep rotating the most injured units back to safety, and focus fire on 1 unit at a time for the kill. you dont aways have to hold the border if you are getting overwhelmed, enemy units heal less inside your territory anyway.