New Zealand international Afoa was cited after a tackle on full back Felix Jones during the second half of the match Ulster won 22-16 at Thomond Park Stadium on Sunday.
"The judicial officer upheld the citing complaint and found the offence warranted a red card and ... determined the offence was at the mid-range entry point of six weeks," said a European Rugby Club statement.
"Having then considered the mitigating factors, including the player's clean record, good character, age and experience, the judicial officer allowed a reduction of three weeks before imposing a suspension of four weeks."
Afoa will be available again on May 7, meaning he can play in the Twickenham final should Ulster beat Edinburgh.
"Ulster Rugby is disappointed with the outcome, and John Afoa himself is very disappointed, particularly in view of his outstanding disciplinary record where he has never previously received a yellow or red card during his professional career," the club said on their website (www.ulsterrugby.com).