The Rev. William H. Gray III recalled yesterday how his late father, then the pastor of Bright Hope Baptist Church, was set to speak to the student body at Simon Gratz High School, where the younger Gray was a student.

"Don't worry, you can keep it short," the school principal told the Rev. William Gray Jr., according to his son. "These kids aren't going anywhere."

The father turned to the discouraging administrator and quipped, "I don't know about these other kids, but I know one kid who is going somewhere."

Gray, who yesterday gave his farewell sermon at the church at 12th Street and Cecil B. Moore Avenue in North Philadelphia after almost 35 years at the helm, said he remembered his father's words whenever he achieved success.

They stuck with him during his run for Congress, in which he served from 1979 to 1991. And when he was elected the first African-American chairman of the Budget Committee just six years after his arrival.

They stuck with him when he became chairman of the Democratic caucus and the majority whip, the highest-ranking African-American to serve in Congress, and when he became president of the United Negro College Fund.

"I had the audacity to believe I could do anything I wanted to," said Gray, who becomes pastor emeritus.

Over the years, the 2,500-member congregation seems to have believed in him as well. His introduction yesterday at the altar by Bright Hope's incoming pastor, the Rev. Kevin R. Johnson, brought the crowd to its feet.

Saying this was only Gray's "farewell sermon," Johnson promised that Gray "will be back to preach, to share with us."

He's "a great man of God whom I highly respect," Johnson said.

Congregants also praised Gray.

"He's been a wonderful pastor, a good leader, good for the community," said Cheryl McKnight, 46, of Northeast Philadelphia.

Harriet West, who has been a member of Bright Hope for 24 years, became emotional talking about the outgoing pastor.

"He was a good leader, not only for Bright Hope, but for the United States and the world."

During his first year on the Budget Committee, Gray said, he won an allocation of $25 million for AIDS, the first time funds were set aside for the disease. He said he was also instrumental in Amtrak's decision to invest money in the renovation of 30th Street Station.

Now he wants to spend quality time with his wife, children and grandchildren. He'll also keep working by helping one of his sons with a consulting business.

No matter how high Gray soared, he always returned to Philadelphia.

That connection to the city "made him special," said U.S. Rep. Bob Brady, one of many well-wishers who spent several minutes in line to meet with Gray after the service.

Gray preached about change, referring to a Bible verse that discusses a transition in leadership from Moses to Joshua.

"In order to grow, there must be change," he said from the pulpit. "Everything must change. Nothing can remain the same."

Later, during an interview with members of the press, Gray said he preferred to "pass the baton when you're still strong."

Johnson, he said, is "going to be a superb" leader who will "help the church move into the 21st Century."