Government bonds in the U.S. and U.K. pulled back Friday as Bank of England Governor Mark Carney stirred up some anxiety that an interest-rate increase could come sooner than many had expected.

Mr. Carney late Thursday said interest rates in the U.K. could rise sooner than investors expect amid signs of an improving economy. Traders said the remark raises some concern that the Federal Reserve could also move forward its timing for interest-rate increases if the U.S. economy gains more momentum. The Fed's next policy meeting is scheduled for June 17-18.

Shorter-dated bonds in the two countries were hit the hardest as their yields are the most sensitive to the direction of central bank interest-rate policy. The yield on the two-year U.K. government bond hit a three-year high. The yields on the two-year and five-year Treasury notes rose to the highest since early May.

"[Mr.] Carney's comments to some are a reminder that central bankers are prone to changing their minds when the facts change, pushing up bond yields," said Tony Crescenzi, senior market strategist at Pacific Investment Management Co. in Newport Beach, Calif.

In late-afternoon trade, the benchmark 10-year Treasury note was 4/32 lower, yielding 2.602%, according to Tradeweb. Bond yields rise when their prices fall.

The yield was little changed for the week. It traded at 3% at the start of the year.

Friday's selling in Treasury bonds was contained by a report showing U.S. consumer sentiment fell to the lowest level in three months. Traders said ongoing tension in Iraq, which boosted bond prices a day earlier, also drew in buyers seeking safety from geopolitical risk.

"[Mr.] Carney brought some fear on higher interest rates, but in the more immediate future investors don't want to be short in front of the political uncertainty over the weekend," said Larry Milstein, head of government and agency trading at R.W. Pressprich & Co. in New York.

A short wager bets that bond prices will fall.

Many investors have expected the BOE be the first major central bank to start to raise interest rates again, probably in early 2015. The Fed is expected to follow suit later in 2015. Now investors are worried that a rate increase from the BOE could come as soon as this year as the U.K. economy has shown signs of gathering momentum.

The yield on the two-year government bond in the U.K. climbed to 0.865%. In the U.S., the five-year note's yield rose to 1.710% and the two-year note's yield increased to 0.459%.

Rate-rise expectations in the U.S. ticked up modestly. The odds of a rate increase from the Fed's June 2015 meeting rose to 55% from 49.5% on Thursday, according to data from CME, a major derivative exchange based in the U.S. The odds were 44% a month ago.

Bond yields remain at very low levels from a historical perspective. Major central banks slashed interest rates to record lows following the 2008 financial crisis. The European Central Bank was the latest to cut rates last week.

Some analysts said the Fed wouldn't be in a rush to raise rates given the uneven pace of economic growth while inflation remains contained. Friday, a report showed inflation at the wholesale level unexpectedly fell 0.2% last month.

Fed policymakers "don't want to spook bond investors and send bond yields much higher right now," said Alex Manzara, vice president of rate futures at R.J. O'Brien & Associates in Chicago. "I don't think they are really concerned about inflation at the moment with wage pressure remaining tame."

The 10-year yield had tumbled from the start of this year, driven by uncertainty over whether the U.S. economy would accelerate after a harsh winter. The world's largest economy contracted 1% in the first quarter, raising some concerns about whether it could post a 3% growth rate this year, which was forecast by many economists.