I know it's a line from Falstaff in one of the plays about Henry V in his younger, wilder days. From the context he's talking with a character named Shallow talking about how they're getting older, but I can't tell if they mean "we've raised hell" or "we hear the time of death coming close" or what it means.
Tried doing a Google search and I just found a bunch of reviews of Orson Welles's movie.
SHALLOW Ha, cousin Silence, that thou hadst seen that that this knight and I have seen!—Ha, Sir John, said I well?
FALSTAFF We have heard the chimes at midnight, Master Shallow.
SHALLOW That we have, that we have, that we have. In faith, Sir John, we have. Our watchword was “Hem, boys.” Come, let’s to dinner, come, let’s to dinner. Jesus, the days that we have seen! Come, come.
First, the chimes -- the audible tolling of a bell was and is a fairly ubiquitous way of telling time, and the most literal sense of that line is obvious -- "we used to stay up until midnight", in itself not an easy task in an era before artificial light and caffeine. The more typical late medieval/Early Modern indicator of when to start turning in for the night might be the 8 or 9 o'clock curfew bell, signifying not just the time to get off the street and head indoors like a modern curfew but also preparation for sleep, as the day's labors wrap up and households bank their fires. There were very few legitimate reasons to be out past curfew, and it's unlikely that when Shallow and Falstaff heard the chimes at midnight they were up to any of those things -- by their own account of it, they were up to no good, either acting in the commission of a crime or simply disregarding the standard decorum of medieval life in pursuit of an illicit good time. Back in 1 Henry IV Falstaff has some things to say to Prince Hal about what he and his companions get up to all night shortly after Hal makes fun of him for sleeping all day:
Marry then, sweet wag, when thou art king, let not us that are squires of the night’s body be called thieves of the day’s beauty. Let us be Diana’s foresters, gentlemen of the shade, minions of the moon, and let men say we be men of good government, being governed, as the sea is, by our noble and chaste mistress the moon, under whose countenance we steal.
(At this point these "gentlemen of the shade" include Hal himself -- it's possible to stage the attempted robbery of the king's baggage train as taking place at night, but I'm not sure how I'd feel about that given how Falstaff's conflicting accounts of how dark it was are played for comedy later.) To be out past dark, late enough to hear the clock tolling midnight, would be to take a risk in an era before the ubiquity of artificial light -- to expose oneself to violence and robbery, or to announce to your neighbors that you were a potential robber yourself. Falstaff's professed affiliation with the night in 1H4, and his claim to have (regularly?) stayed out past midnight with Shallow in the days of their youth, associate both of them with lawlessness and daring.
Back in those days Shallow was a law student at Clement's Inn, and he fancies himself to have achieved lasting notoriety there as one of the many young men whose new independence from parental authority allowed them to get up to no good. (Think "you have been murdered by clerks".) Given what Falstaff later says about Shallow's youth, Shallow's nocturnal pursuits were much less impressive than he makes them out to be in his old age -- if he truly did hear the chimes at midnight, he was up and about late at night in pursuit of lechery, questing for babes and not getting into epic brawls or committing daring crimes. Shallow and Falstaff are spinning yarns about their shared reckless youth but all their reminisces just hammer in how they've grown old and no longer do these things, or perhaps never did them to begin with. (The attractive loose women they used to know are now just as old as they are, and have held up equally poorly under the weight of age -- a realization which could put anybody in the mood to contemplate mortality.) Another helpful antecedent for what hearing the chimes at midnight means might be the line about spending all night in a windmill -- that's a fairly typical youthful exploit that would be small potatoes to someone like Prince Hal, disreputable and borderline unlawful but nothing to actually brag about. Falstaff and Shallow are sick old men, and the thought of staying up all night and sleeping out of doors on the bare ground is beyond them now, but they're still proud of the exploits of their youth whether or not those petty exploits are anything to be proud of.
Shallow has grown borderline-respectable with the passage of time, even if Falstaff has not -- if he hasn't grown wise, he's at least grown rich -- and these reminisces are serving to butter him up a little for Falstaff's purposes. Falstaff knows how overblown Shallow's recollections of brawls and nocturnal adventures and rubbing shoulders with famous people are, and that Shallow is just blowing smoke, but he's participating in Shallow's self-deceit out of his own self-interest. In that sense, I think "hearing the chimes at midnight" serves as a remembrance of how deep into old age these men are -- they're long past their useful years, at an age where their chief pastime is bragging about how badass they used to be 50 or 60 years ago, and their recollections of their previous vigor just sound foolish to anyone who was actually there and can remember the truth. Even Falstaff knows these recollections they're sharing are BS, and he's the king of BS. Shakespeare being Shakespeare, I think the interpretation that this line pulls double duty is a reasonable one, alluding to both men's supposed youthful exploits and the imminent end of their lives -- but the most literal sense is that back in the day, Falstaff and Shallow used to stay out all night together, or at least are claiming to have stayed out all night together, and staying out past midnight in a medieval town was a much more nervy prospect than staying out past midnight in a well-lit modern city.