After recovering, Anderson joined the Confederate Army of the Potomac in February 1862 (which was absorbed into the Army of Northern Virginia later in the spring) as a brigade commander. Anderson distinguished himself during the Peninsula Campaign, temporarily assuming division command at Seven Pines when Longstreet was serving as a wing commander. At Seven Pines he gained the sobriquet "Fighting Dick", and was promoted to major general on July 14 and received command of General Benjamin Huger's former division. As part of Longstreet's corps, Anderson fought at Second Bull Run. His division engaged the final Union defensive line around Henry House Hill, but the sun was starting to go down and he did not press the attack.