I can suggest lots of things, but will keep on the topic of marksman.
The best defense against skarpskytters is another. Better tactics make a difference. For instance do you know what's going on with the lights in this picture? Why would he point lights at himself? Wont that make him easier to see?
Lights pointed towards an object obscure objects behind them. In this photo the shooter is using a loophole to remain concealed and lights to further mask their location and muffle light flash from the rifle, by angling them in such a way that obscures him but allows him to see his target. He's at a standoff distance from the loophole as well, which also aids in his concealment, not right on top of it like in this picture.
Screens can be used too for flash concealment. Again, the shooter has employed some fancy lighting, a cloth screen and FFP (Final Fire Position) location to present the room as being empty when viewed from outside and the screen masks the sound and flash of the shot.
Here's another shot illustrating these techniques. Screen + Fancy lighting + standoff FFP = well concealed shooter, even after taking a shot.
Western military employ squad-sniper stacks where each man has a role in the team. One man for demolitions, one as a JTAC for air or artillery support, one or two for security employing wire traps, noise makers and rapid-fire weapons to alert the stack to enemy movements and help them get away from trouble, one as the primary shooter and one as the secondary shooter. Another might employ counter electronics or surveillance gear.
Better training helps negate technological advantages like thermal gun sights, but so to do better tactics. Often tactical changes force an adversary to have to adapt to you, rather then you playing catchup to them. Pair them with better technologies, since it's harder to overcome well designed and flexible tactics then it is technological crutches.
Employing technologies like high-fidelity shot locators can help, but against a well concealed or skilled marksman they're of less use. Using the techniques above, a marksman can baffle shot locators by hiding the sound of their rifle using cleaver acoustic trickery like positioning or screens and loopholes, not to mention shot suppressors.
Better tactics, better training and better gear to support them. That's what I suggest.
If that fails a PGM never does
.
Of course these tactics are situational, pertaining in particular to marksmanship in urban environments, but other tactical shifts will work in other situations. That's for the either side to explore for themselves.