Tyler Lyness, 30, admitted seven sexual offences including rape at a previous hearing at Bradford Crown Court.
Officers found indecent images of him and other children on his computer when they seized it during a raid last November, West Yorkshire Police said.
Detectives said he had been "entrusted to look after" the child.
Lyness, of Williams Road, Steeton, Keighley, was sentenced at the same court after pleading guilty to one count of rape, two counts of sexual assault and four of making indecent photographs.
Det Insp Phil Bates said: "It was only when we spoke to the victim that the full extent of Lyness's crimes started to become clear.
"He was entrusted to look after this boy, but committed a gross abuse of this trust by sexually assaulting him and sharing indecent images of him on the internet."
A man who raped a four-year-old boy and shared indecent images of him on the internet has been jailed for 10-and-a-half years.