Gregory Paul Houchins is being held on $5.1 million bail at the West Contra Costa County detention facility.
Police say he met the child in the video game section of the Pinole Target store two weeks ago. He forced the child to touch his private parts and took him to bathroom where the child got away and ran to his parents.
He's also accused of trying to take photos of women's feet at the same store.
Surveillance cameras captured an image of Houchins when he returned to the same store two days later.