U.S. stocks eked out modest gains on Friday and all three indexes posted another weekly advance as investors parsed comments from Federal Reserve officials and looked ahead to crucial inflation data next week.