The pair met in in New York, where Barlow offered Styles songwriting advice as well as the opportunity to work with him to pen a tune, reported Sun online.
"Gary has been over in New York working on music for a Broadway musical version of 'Finding Neverland'. He heard Harry was in town and arranged to meet up," a source said.
"They had a great afternoon talking about Gary's life in Take That as a young bloke and then more recently. Harry is an attentive guy and really listens. He likes keeping older company and soaks up as much advice as he can get. Gary talked him through his songwriting techniques and offered to write with him whenever they get the chance," it added.