You're focusing correctly on the two likeliest counties in your search. Although the surname Gallagher is usually associated with County Donegal, and there are still many Gallagher’s there, scholars now believe that a separate Gallagher "clan" originated in the Mayo/Galway area (the county boundaries were a later creation). In Irish, Gallagher is Ó Gallchobhair (modern Irish spelling Ó Gallchúir), and it means “descendant of the foreign help”, referring to a mercenary warrior brought in from Scotland or elsewhere in Ireland to fight in local wars (known as a gallóglach, or “gallowglass”). It may also refer to Norse ancestors, since the term "gall" was used for them as well (that is the root word in the name Galway (Gaillimh in Irish).
Roger is right about the parish and civil records not going back far enough to find your specific ancestor, but you may be able to figure out which county he came from through DNA testing. My grandfather was a Gallagher from East Mayo, and Gallagher's are particularly numerous there. I and several of my second and third cousins have had our DNA tested and, if you have as well, it might be possible to find a connection in Mayo, if that turns out to be the right place (we have our results posted at the free GEDMATCH site). Late last year, I was able to make a connection to another Gallagher branch in East Mayo where the most recent common ancestor probably lived in the 1780's or even earlier. We can't establish the connection on paper, because the oldest parish records in the area generally go back no earlier than the 1820's (though a few go back almost to 1800). I'm in the US, but I've turned up several (smaller) DNA matches to Gallagher's in the Maritime Provinces where the connection must be from the 18th century, judging by how long their families have been in Canada.
If you can establish a location, it may at some point be possible to go back beyond what the parish registers show, through records such as estate books. Other records, such as probate records and court records, can also be helpful, but the former are not common for tenant farmers in the eighteenth century, and the latter may not give much genealogical information.
The vast majority of people in those days were tenant farmers, and the landlords (or their agents) kept what are known generically as "estate records", dealing with the finances and other information for their estates. Sometimes those records can be very detailed, and they can go back a long time. When the great estates were broken up in the 19th and early 20th century, some landlords took their records back to England, some ended up in various archives in Ireland, and some were probably lost. If one can locate the records for an area, one might be able to find good genealogical info. For example, there could be records saying things like "John Gallagher died on ___, and his tenancy is now being taken over by his son Tadhg Gallagher". I've only recently started to search for the name(s) of the landlord(s) in East Mayo. There are two genealogical societies there, and I know one of them holds some of the estate records in its collections, and they probably have information about where to find some of the other sets of records. If your DNA matches point instead to Donegal, you may be able to try the same type of research there.