Graham, 21, was given an out-of-competition test by UK Anti-Doping on February 17, the eve of the 2015 season.
The suspension applies until March 10, 2019.
Graham, who previously played for Huddersfield, made 11 appearances for the Cougars in 2014 when they were relegated to Kingstone Press League 1 from the Championship.
Rugby World Cup postponed until 2022 after New Zealand and Australia withdrawals
UKAD's director of operations Pat Myhill said: "Athletes are solely responsible for any banned substance which is found in their system, regardless of how it got there or whether there was an intention to cheat or not.
"Under the 2015 World Anti-Doping Code, the sanction for a deliberate doping offence has now increased from two to four years.
"Lewis Graham is a young player who has been banned from playing sport for a considerable amount of time.
"This case highlights that all athletes, regardless of level, must be aware, and understand, the risks to their sporting careers if they test positive. They must ensure they manage that risk at all times."
Rudge: St Helens did rugby league 'proud' by winning maiden Challenge Cup title
Responsibility on Challenge Cup final to "showcase women's game at its best"