Barry is another stock Spielberg character, who serves to teach us the advantage of childlike curiosity and an innocent worldview. Granted, he's only three years old, so he's got an advantage. Even so, his innocence makes him see the aliens' intentions for what they really are: a search for friendship and connection.
As the aliens fly over Barry's neighborhood, their energy field turns on all the electric toys in his room. An adult would probably freak out—we've all seen Chucky. Barry's surprised yet enraptured expressions, as well as his willingness to explore the house vs. dive under the bed, show us that he's curious about this strange phenomenon, not scared:
BARRY: You can come and play now. You can come and play now. Come in through the door.
The first time the aliens visit the Guilers, we observe it from Jillian's point of view. The eerie lights shining through the window, the aliens trying to sneak their way into the home, the destruction of appliances in a way that most definitely voided the warranty—all very scary stuff. They sure don't look harmless.
But the next time, we get more of Barry's POV; he watches the whole affair not as an invasion but as play. He intuitively understands the aliens' purpose—they aren't trying to terrify or threaten Jillian; they just don't know the proper etiquette for inviting the boy over for a sleepover in space. It's a very toddler thing to do, and important to the film's message of embracing and learning from the new.
While Jillian tries to protect her son, Barry sneaks out the doggy door and joins the extraterrestrials for his play date. We don't see him again until the very end of the film when the mother ship finally makes contact. He stumbles out unharmed and tells mom about his adventure:
BARRY: I went up in the air and I saw our house.
Barry cries when he sees that the spacecraft is leaving. He says "bye" to his buddies and sobs on his mom's shoulder. Maybe the aliens had swooped past Disney World and picked up Buzz Lightyear's Space Ranger Spin on their way to Muncie.
This kid is gonna love E.T.