It is hard to tell for certain which part of speech this usage of the well represents. If you search very hard in dictionaries, you may be able to find the correct definition of this word listed under its use as an adverb. However, what these dictionaries will not tell you is that this meaning of the word well, meaning something like to a considerable degree, is grammatically very limited. In particular, we use it almost exclusively to modify prepositions or preposition phrases in standard English:
- well beyond its sell by date
- well after midnight
- well before the deadline
- well inside the line
- well outside of the terms and conditions
This 'adverb ' well is part of a family of other adverbs such as straight, right, fresh, long, dead and so forth that are used with special meanings to modify prepositions. Although their usage is very common, their meaning when used to modify prepositions is quite different to their meaning in other environments. The other thing about them is that they all look very much like adjectives and not adverbs at all. There is very little evidence, as far as I can ascertain, to make us think that they actually are adverbs—as opposed to adjectives—at all.
Here are some more examples:
- fresh out of college
- right over the net
- straight after the concert
- long before the second world war
- dead on time
We cannot use them like normal adverbs in standard English at all, although they are indeed used that way in some regional Englishes. For example we cannot use them to modify adjectives. The following are all ungrammatical in standard English, but fine in some regional varieties:
- It was well good.
- It's right hot in here.
- She's dead brilliant.
If you scroll down past well as a verb, noun and adjective at the Merriam Webster Dictionary you will find the adverb well. If you scroll down further to the fifteenth definition thereunder, you will find the following definition:
: to a large extent or degree : considerably, far < well over a million >
This is the meaning in the Original Poster's example, where well after midnight means something similar to long after midnight.
What the dictionary will not tell you, however, is that interestingly, this meaning of the word well is confined in standard English almost entirely to the modification of prepositions.