Tetsujin gives a good answer (I upvoted), but I feel I can add some additional ideas.
Compression is making quiet sounds louder and loud things quiet, and it is naturally something that amps do when pushed enough. There are techniques common in rock guitar, specifically tapping and harmonics, that could always have been done but weren't common until amplification and compression made it so these could be as loud as normal playing.
Traditional guitar has always been a punchy high-attack low-sustain instrument, but with amplification and compression, you can get these longer notes and chords, but there eventually comes a point where the note fades.
Clearly these are cases where you must revive the note by periodically picking it so that it will maintain its intensity and reach the required ringing time.
There are techniques to handle this. There are technologies to handle this. The first one I can think of is tremolo picking, which you might recall from the meatball scene from Lady and the Tramp. Instead of strumming once and leaning on the sustain, you pick a lot, like on sixteenth notes or so, and let the continual picking be heard as sustain.
Next is the addition of string vibration by feedback. The common way is by standing in front of the amp or monitor and letting the sound move the strings, which get amplified, and so on. The Sustainer and Sustainiac systems use an electromagnet in the neck position to allow it to send the currently-played note back into the strings, not just pick it up. The EBow and similar systems use magnets to just vibrate a string. It's similar to but different from the built-in systems, in that it doesn't know what is being played. This all very much gets you into the infinite sustain thing.
The pedal-steel guitar way is different, in that you use a volume pedal and a loud clean amp. Here, you play the note, drop the volume to where you want it to be, and as the note decays, you add volume back, so it just sounds like the note sustains a long time. This is a bit like doing the same thing compressors do, just with your foot.
Also, the Freeze and other infinite sustain pedals, kinda delay pedals that just play back short samples of a previous note or chord.
However, whenever I try to do that, I am painfully aware of when the note is being re-picked.
There are a few things you can do, but this does skew more ambient and far less rock. The first is to swallow the pick attack. Compression can help a little, but my go-to here is use a volume pedal to hide when I pick. Issue is, now instead of that new click, you get silence.
This is when you use delay and reverb to hide the point in time when the strum or fade happened.