No. "Afterlife" by Avenged Sevenfold was not featured in any of the live-action Transformers films.
The band's music has appeared in other media (e.g., "Almost Easy" in NHL 08, "Nightmare" in Call of Duty: Black Ops), but not in Michael Bay's Transformers franchise. The confusion may stem from the song's cinematic, high-energy feel or misattributed soundtrack lists.