In a season of ups and mostly downs for Sonny Gray, this was undoubtedly the nadir: exiting the game to the sound of booing from the biggest Yankee Stadium crowd of the season, having just allowed seven earned runs in less than three innings to the worst team in baseball. And yet, as he walked off the mound, he was flashing a toothy grin.

Gray had pitched well in his previous three starts, offering hope that he was returning to the form he had showed in the first three years of his career with the Oakland Athletics. But on Wednesday Gray turned in his worst outing of the season at a very poor time, with the Yankees about to embark on a four-game series on the road against the Boston Red Sox, the team they trail by five and a half games in the American League East.

“Honestly, I was just frustrated,” Gray (8-8, 5.56 E.R.A.) said of his smiling after the Yankees 7-5 loss to the Orioles. “I think that everyone handles frustrations differently. I’ve never been a guy who, when things aren’t going his way and you get hit around, to come off the field and throw a glove or throw a hat or punch something. I’ve always been a mellow guy who tries to think things through and get over it and move on. That’s the way I’ve handled things my whole life. Whether that’s good or bad, I don’t know.”

Clearly, the Yankee Stadium crowd of 47,206, swelled by an additional 2,000 fans admitted via standing-room admission introduced for August, thought it was bad. And for the first time this season, Manager Aaron Boone entertained the thought of removing Gray from the starting rotation — an option made more attractive by the performance of the newly acquired Lance Lynn, who pitched four and one-third scoreless innings in relief of Gray.