Afridi, who was arrested immediately after the May 2, 2011 operation by US commandos that killed bin Laden, was convicted for treason over alleged ties to the Lashkar-e-Islam militant group.
"On Dr Afridi, our position has not changed. It's long been clear. And we made it clear again during this visit that we believe his incarceration is both unjust and unwarranted. He should be released," State Department Deputy Spokesperson Marie Harf told reporters at her daily news conference.
"Bringing Osama bin Ladin to justice was in both Pakistan's interest and, of course, ours as well. Continuing to prosecute and incarcerate Dr Afridi sends exactly the wrong message about our shared interest in going after al-Qaida," Harf said.
Obama in his meeting with Sharif on Wednesday had made a similar demand.
More From This Section
"Our relationship with Pakistan continues on a positive trajectory - that's across the board - on the variety of issues that we talk about," she said.
Counter-terrorism, she said, was one of the major topics of discussions.
"The Pakistanis, we talk to them a lot about the shared threat of counterterrorism. Clearly, there is an extremist threat that they're working very hard themselves to counter in their own country. We're helping them to counter that. And we'll keep working together to confront violent extremism as it arises," she said.
"But we know, again, that Pakistanis themselves have suffered at the hands of terrorists more than anyone else. I think over the last 10 years about 40,000 Pakistanis have been killed at the hands of terrorists," she said.